Part Number Hot Search : 
20820 DMG3402L CD4517B 7C1354 60CDQ35 2SK14 USB6B1 UPD75
Product Description
Full Text Search
 

To Download LPC812M101FDH20 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 lpc800 user manual rev. 1.0 ? 7 november 2012 preliminary user manual document information info content keywords arm cortex m0+, lpc800, usart, i2c, lpc810m021fn8, lpc811m001fdh16, lpc812m101fdh16, lpc812m101fd20, LPC812M101FDH20 abstract lpc800 preliminary user manual
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 2 of 313 contact information for more information, please visit: http://www.nxp.com for sales office addresses, please send an email to: salesaddresses@nxp.com nxp semiconductors um10601 lpc800 user manual revision history rev date description 1 20121107 preliminary lpc800 user manual
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 3 of 313 1.1 introduction the lpc800 are an arm cortex-m0+ based, lo w-cost 32-bit mcu fa mily operating at cpu frequencies of up to 30 mhz. the um10601 support up to 16 kb of flash memory and 4 kb of sram. the peripheral complement of the um10601 includes a crc engine, one i 2 c-bus interface, up to three usarts, up to two spi interfaces, one multi-rate timer, self wake-up timer, and state-configurable timer, one co mparator, function-configurable i/o ports through a switch matrix, an input pattern match engine, and up to 18 general-purpose i/o pins. 1.2 features ? system: ? arm cortex-m0+ processor, running at frequencies of up to 30 mhz. ? arm cortex-m0+ built-in nested vectored interrupt controller (nvic). ? micro trace buffer ? system tick timer ? memory: ? 16 kb on-chip flash programming memory. ? 4 kb sram. ? in-system programming (isp) and in-application programming (iap) via on-chip boot loader software. ? boot rom api support: ? uart drivers ? i2c drivers ? power profiles ? iap/isp ? digital peripherals: ? high-speed gpio interface connected to the arm cortex-m0+ i/o port with up to 18 general purpose i/o (gpio) pins with configurable pull-up/pull-down resistors. ? pin interrupt generation ca pability with boolean pattern -matching feature onup to eightselectable gpio inputs. ? switch matrix for flexible confi guration of each i/o pin function. ? state configurable timer (sct) with input and output functions (including capture and match) assigned to pins through the switch matrix. ? multiple-channel multi-rate ti mer for repetitive interrupt generation at up to four programmable, fixed rates. ? wake-up timer for self-timed wake-up from reduced power modes. um10601 chapter 1: lpc800 intr oductory information rev. 1.0 ? 7 november 2012 preliminary user manual
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 4 of 313 nxp semiconductors um10601 chapter 1: lpc800 introductory information ? crc engine. ? windowed watchdog timer ? analog peripherals: ? comparator with external voltage refere nce with pin functions assigned through the switch matrix. ? internal reference voltage. ? serial interfaces: ? three uart interfaces with pin functions assigned through the switch matrix. ? two spi controllers with pin functions assigned through the switch matrix. ? one i 2 c-bus interface with open-drain full i2c spec fast modeplus. ? clock generation: ? 12 mhz internal rc oscillator trimmed to 1 % accuracy that can optionally be used as a system clock. ? crystal oscillator with an opera ting range of 1 mhz to 25 mhz. ? programmable watchdog oscillator with a fr equency range of 9.4 khz to 2.3 mhz. ? pll allows cpu operation up to the maximum cpu rate without the need for a high-frequency crystal. may be run from the external clock input (clkin), the system oscillator, or the internal rc oscillator. ? power control: ? integrated pmu (power management un it) to minimize power consumption. ? reduced power modes (sleep, deep-sleep, power-down, deep power-down). ? power-on reset (por). ? brownout detect. ? unique device serial number for identification. ? single power supply. ? available in a so20 package, tssop20 package, tssop16, and dip8 package.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 5 of 313 nxp semiconductors um10601 chapter 1: lpc800 introductory information 1.3 ordering information table 1. ordering information type number package name description version lpc810m021fn8 dip8 plastic dual in-line package; 8 leads (300 mil) sot097-2 lpc811m001fdh16 tssop16 plastic thin shrink small ou tline package; 16 leads; body width 4.4 mm sot403-1 lpc812m101fdh16 tssop16 plastic thin shrink small ou tline package; 16 leads; body width 4.4 mm sot403-1 lpc812m101fd20 so20 plastic small outline package; 20 leads; body width 7.5 mm sot163-1 LPC812M101FDH20 tssop20 plastic thin shrink small ou tline package; 20 leads; body width 4.4 mm sot360-1 table 2. ordering options type number flash/kb sram/kb usart i 2 c spi comparator gpio package lpc810m021fn8 4 1 2 1 1 1 6 dip8 lpc811m001fdh16 8 2 2 1 1 1 14 tssop16 lpc812m101fdh16 16 4 3 1 2 1 14 tssop16 lpc812m101fd20 16 4 2 1 1 1 18 so20 LPC812M101FDH20 16 4 3 1 2 1 18 tssop20
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 6 of 313 nxp semiconductors um10601 chapter 1: lpc800 introductory information 1.4 block diagram fig 1. lpc800 block diagram  
 
       
  

 
   
    
   
 !"#! $
%&'
!#&()#"$   $"%*+ $"%*+ $"%*+  
$"%*+  $"%*+ 
    
    
  $!   ,  ,    -./0,1   -./0,1 
2
, 
2
    
   
          3   3  3  -   3
  3
  - 4 
 
 
 
  

 3     3
  3
     3
  3
    

draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 7 of 313 nxp semiconductors um10601 chapter 1: lpc800 introductory information 1.5 general description 1.5.1 arm cortex-m0+ core configuration the arm cortex-m0+ core runs at an operating frequency of up to 30 mhz. integrated in the core are the nvic and serial wire debu g with four breakpoints and two watchpoints. the arm cortex-m0+ core supports a single-cycle i/o enabled port (iop) for fast gpio access at address 0xa000 0000. the core includes a single-cycle multip lier and a system tick timer (systick).
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 8 of 313 2.1 how to read this chapter the memory mapping is identical for all lpc800 parts. different lpc800 parts support different flash memory sizes. 2.2 general description the lpc800 incorporates several distinct memory regions. figure 2 shows the overall map of the entire address space from the user program viewpoint following reset. the apb peripheral area is 512 kb in size and is divided to allow fo r up to 32 peripherals. each peripheral is allocated 16 kb of space simplifying the address decoding. the registers incorporated into the arm cort ex-m0+ core, such as nvic, systick, and sleep mode control, are located on the private peripheral bus. the gpio port and pin interrupt/pattern match registers are accessed by the arm cortex-m0+ single-cycle i/o enabled port (iop). um10601 chapter 2: lpc800 memory mapping rev. 1.0 ? 7 november 2012 preliminary user manual
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 9 of 313 nxp semiconductors um10601 chapter 2: lpc800 memory mapping 2.2.1 memory mapping 2.2.2 micro trace buffer (mtb) the lpc800 supports the arm co rtex-m0+ micro trace buffer. the private peripheral bus includes the arm cortex-m0+ peripherals such as the nvic , systick, and the core control registers. fig 2. lpc800 memory mapping 
5+)657+)%"$ ,2 ,,,
,,, ,2 ,,,
,,, ,2 ,,,
,,, ,2 ,,
,,,, ,2 ,,
,,, ,2 ,,
,,,, ,2 ,,
,,, ,2 ,,/
,,, ,2 ,,/
,,, ,2 ,,
,,,, ,2 ,,
,,, ,2 ,,
,,, ,2 ,,
,,, ,2 ,,8
,,,, ,2 ,,8
,,, ,2 ,,8
,,, ,2 ,,
,,,, ,2 ,,
,,, ,2 ,,
,,,, ,2 ,,
,,, ,2 ,,
,,, ,2 ,,
,,, ,2 ,,,
,,,,  
$+"9
:% +;5
(6<+)  /


)+$+)*+' %&%"#=
!#<5%)%(#) ,2 ,,
,,, )+$+)*+' )+$+)*+' )+$+)*+' )+$+)*+' ,2 ,,/
,,,, ,2 ,,/
,,, ,   / 8  >  ?  8  >  )+$+)*+' )+$+)*+' ,2,,,,
,,,, ,
 ,@8

 
 ,2,,,
,,,, ,2
,,,, ,2
,,, ,2,,,
,,,, ,28,,,
,,,, ,28,,,
,,, ,2
 )+$+)*+' )+$+)*+' )+$+)*+' ,2 ,,,
,,,, ,2 ,,
,,,, 
5+)657+)%"$ ,28,,,
,,, ,2,,,
,,,, ,2,,,
,,,    ,2,,,
,,, 56&
6&(+));5($5%((+)&
<%(!7 ,2,,,
, ,, 


a,b ,2,,,
,,, 


ab ,2,,,
,,,


ab ,2 ,,
,,,, ,2 ,,
,,,

  ,2,,,,
,,, ,2,,,,
,,, ,2,,,,
,,, 

#&!765
9"%$7
ab 

#&!765
9"%$7
ab

#&!765
9"%$7
a,b 

c##(
 ,2,,,,
,,,, ,2,,,,
,,, %!(6*+
6&(+));5(
*+!(#)$  )+$+)*+' )+$+)*+' )+$+)*+' )+$+)*+' 9"%$7
!#&()#""+) , $:6(!7
<%()62    ,2 ,,8
,,, ?  /   , ,2 ,,
,,,   ,2 ,,
,,,   ,2 ,,>
,,,,  ,2,,,
,,,, ,2,,
,,,, 5)6*%(+
5+)657+)%"
c;$  ,  8  > )+$+)*+' )+$+)*+' )+$+)*+' )+$+)*+' )+$+)*+' )+$+)*+' )+$+)*+' )+$+)*+' )+$+)*+' ,   /
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 10 of 313 3.1 how to read this chapter the nvic is identical on all lpc800 parts. the spi1 and usart2 interrupts are implemented on parts LPC812M101FDH20 and lpc812m101fdh16 only. 3.2 features ? nested vectored interrupt controller that is an integral part of the arm cortex-m0+. ? tightly coupled interrupt controller provides low interrupt latency. ? controls system exceptions and peripheral interrupts. ? the nvic supports 32 vectored interrupts. ? four programmable interrupt priority levels with hardware prio rity level masking. ? software interrupt generation using the arm exceptions svcall and pendsv. ? support for nmi. ? arm cortex m0+ vector table offs et register vtor implemented. 3.3 general description the nested vectored interrupt controller (nvic) is an integral part of the cortex-m0+. the tight coupling to the cpu allows for low interr upt latency and efficient processing of late arriving interrupts. 3.3.1 interrupt sources ta b l e 3 lists the interrupt sources for each peripheral function. each peripheral device may have one or more interrupt lines to the vectored interrupt controller. each line may represent more than one interrupt source. the interrupt number does not imply any interrupt priority. see ref. 1 for a detailed description of the nvic and the nvic register description. um10601 chapter 3: lpc800 nested ve ctored interrupt controller (nvic) rev. 1.0 ? 7 november 2012 preliminary user manual table 3. connection of interrupt sources to the nvic interrupt number name description flags 0 spi0_irq spi0 interrupt see table 192 ? spi interrupt enable read and set register (intenset, addresses 0x4005 800c (spi0) , 0x4005 c00c (spi1)) bit description ? . 1 spi1_irq spi1 interr upt same as spi0_irq 2 - reserved -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 11 of 313 nxp semiconductors um10601 chapter 3: lpc800 nested vectored interrupt controller (nvic) 3 uart0_irq usart0 interrupt see ta b l e 1 6 1 ? usart interrupt enable read and set register (intenset, address 0x4006 400c(usart0), 0x4006 800c (usart1), 0x4006 c00c(usart2)) bit description ? 4 uart1_irq usart1 interrupt same as uart0_irq 5 uart2_irq usart2 interrupt same as uart0_irq 6 - reserved - 7 - reserved - 8 i2c0_irq i2c0 interrupt see table 175 ? interrupt enable clear register (intenclr, address 0x4005 000c) bit description ? . 9 sct_irq state configurable timer interrupt evflag sct event 10 mrt_irq multi-rate timer in terrupt global mrt interrupt. gflag0 gflag1 gflag2 gflag3 11 cmp_irq analog comparator interrupt compedge - ri sing, falling, or both edges can set the bit 12 wdt_irq windowed watchdog timer interrupt warnint - watchdog warning interrupt 13 bod_irq bod interrupts bodintval - bod interrupt level 14 flash_irq flash interrupt 15 wkt_irq self wake-up ti mer interrupt alarmflag 23:16 - reserved - 24 pinint0_irq pin interrupt 0 or pattern match engine slice 0 interrupt pstat - pin interrupt status 25 pinint1_irq pin interrupt 1 or pattern match engine slice 1 interrupt pstat - pin interrupt status 26 pinint2_irq pin interrupt 2 or pattern match engine slice 2 interrupt pstat - pin interrupt status 27 pinint3_irq pin interrupt 3 or pattern match engine slice 3 interrupt pstat - pin interrupt status 28 pinint4_irq pin interrupt 4 or pattern match engine slice 4 interrupt pstat - pin interrupt status table 3. connection of interrupt sources to the nvic interrupt number name description flags
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 12 of 313 nxp semiconductors um10601 chapter 3: lpc800 nested vectored interrupt controller (nvic) 29 pinint5_irq pin interrupt 5 or pattern match engine slice 5 interrupt pstat - pin interrupt status 30 pinint6_irq pin interrupt 6 or pattern match engine slice 6 interrupt pstat - pin interrupt status 31 pinint7_irq pin interrupt 7 or pattern match engine slice 7 interrupt pstat - pin interrupt status table 3. connection of interrupt sources to the nvic interrupt number name description flags
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 13 of 313 4.1 how to read this chapter the system configuration block is identical for all lpc800 parts. usart2 and spi1 are only available on parts LPC812M101FDH20 and lpc812m101fdh16 and the corresponding clocks, reset, and wake-up control bi ts are reserved for all other parts. 4.2 features ? clock control ? reset control ? pin interrupt set-up ? configuration of reduced power modes ? wake-up control ? bod configuration 4.3 basic configuration configure the syscon block as follows: ? the syscon uses the ckin, clkout, reset , and xtalin/out pins. configure the pin functions through the switch matrix. see section 4.4 . ? no clock configuration is needed. the cl ock to the syscon block is always enabled. by default, the syscon bloc k is clocked by the irc. 4.3.1 set up the pll the pll creates a stable output clock at a hi gher frequency than the input clock. if you need a main clock with a frequency higher than the 12 mhz irc clock, use the pll to boost the input frequency. 1. power up the system pll in the pdruncfg register. section 4.6.32 ? power configuration register ? 2. select the pll input in the syspllclksel register. you have the following input options: ? irc: 12 mhz internal oscillator. ? system oscillator: external crystal oscillator using the xtalin/xtalout pins. ? external clock input clkin. select this pin through th e switch matrix. section 4.6.8 ? system pll clock source select register ? 3. update the pll clock source in the syspllckuen register. section 4.6.9 ? system pll clock source update register ? 4. configure the pll m and n dividers. section 4.6.3 ? system pll control register ? um10601 chapter 4: lpc800 system configuration (syscon) rev. 1.0 ? 7 november 2012 preliminary user manual
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 14 of 313 nxp semiconductors um10601 chapter 4: lpc800 system configuration (syscon) 5. wait for the pll to lock by monitoring the pll lock status. section 4.6.4 ? system pll status register ? 4.3.2 configure the main clock and system clock the clock source for the registers and memories is derived from main clock. the main clock can be sourced from the irc at a fixed clock frequency of 12 mhz or from the pll. the divided main clock is called the system clock and clocks the core, the memories, and the peripherals (register inte rfaces and peripheral clocks). 1. select the main clock . you have the following options: ? irc: 12 mhz internal oscillator (default). ? pll output: you must configure the pll to use the pll output. section 4.6.10 ? main clock source select register ? 2. update the main clock source. section 4.6.11 ? main clock source update enable register ? 3. select the divider value for the system cloc k. a divider value of 0 disables the system clock. section 4.6.12 ? system clock divider register ? 4. select the memories and peripherals that are operating in your application and therefore must have an active cl ock. the core is always clocked. section 4.6.13 ? system clock control register ? 4.3.3 set up the system oscillat or using xtalin and xtalout if you want to use the system oscillator with th e lpc800, you need to assign the xtalin and xtalout pins, which connect to the external crystal, through the fixed-pin function in the switch matrix. xtalin and xtalout can only be assigned to pins pio0_8 and pio0_9. 1. in the iocon block , remove the pull-up and pull- down resistors in the iocon registers for pins pio0_8 and pio0_9. 2. in the switch matrix block, enable th e 1-bit functions for xtalin and xtalout. 3. in the sysoscctrl register, disable th e bypass bit and select the oscillator frequency range according to th e desired oscillator output clock. related registers: table 62 ? pio0_8 register (pio0_8, addres s 0x4004 4038) bit description ? table 61 ? pio0_9 register (pio0_9, addres s 0x4004 4034) bit description ? table 105 ? pin enable register 0 (pinenable0, address 0x4000 c1c0) bit description ? table 10 ? system oscillator control register (sysoscctrl, address 0x4004 8020) bit description ?
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 15 of 313 nxp semiconductors um10601 chapter 4: lpc800 system configuration (syscon) 4.4 pin description the syscon inputs and outputs ar e assigned to external pins through the s witch matrix. see section 9.3.1 ? connect an internal signal to a package pin ? to assign the clkout function to a pin on the lpc800 package. see section 9.3.2 to enable the clock input, the osc illator pins, and th e external reset input. 4.5 general description 4.5.1 clock generation the system control block facilit ates the clock generation. except for the usart clock and the clock to configure the glitch filters of th e digital i/o pins, the clocks to the core and peripherals run at the same frequency. the maximum clock frequency for lpc800 is 30 mhz. see figure 3 . table 4. syscon pin description function direction pin description swm register reference clkout o any clkout clock output. pinassign8 table 104 clkin i pio0_1/acm p_i2/clkin external clo ck input to the system pll. disable the acmp_i2 function in the pinenable register. pinenable0 table 105 xtalin i pio0_8/xtalin input to t he system oscillator. pinenable0 table 105 xtalout o pio0_9/xtalout ou tput from the system oscillator. pinenable0 table 105 reset i reset /pio0_5 external reset input pinenable0 table 105
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 16 of 313 nxp semiconductors um10601 chapter 4: lpc800 system configuration (syscon) 4.5.2 power control of analog components the system control block controls the power to the analog components such as the oscillators and pll, the bod, and the analog comparator. for deta ils, see the following registers: section 4.6.30 ? deep-sleep mode configuration register ? section 4.6.3 ? system pll control register ? section 4.6.6 ? watchdog oscillator control register ? section 4.6.5 ? system oscillator control register ? fig 3. lpc800 clock generation   
 :%(!7'#=
#$!6""%(#) 
#$!6""%(#) 
#$!6""%(#) :%(!7'#=
#$!6""%(#)       a<%6&
!"#!
$+"+!(b   $d$(+<

!"#!
$+"+!( 
4   4 
!"#!
, a!#)+
$d$(+ %":%d$#&b 
4  4  ,      
#$!6""%(#)  "#:5#:+)
#$!6""%(#)  :%(!7'#=
#$!6""%(#) 
#$!6""%(#) $d$(+<
#$!6""%(#) 
4  4 
56&   a
!"#!
$+"+!(b <%6&
!"#! $d$(+<
!"#!    .0?1 a$d$(+<
!"#!
+&%c"+b <+<#)6+$ %&'
5+)657+)%"$ 5+)657+)%"
!"#! $ ? 
4 
4 
="6(!7
96"(+) > 3   3      
   
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 17 of 313 nxp semiconductors um10601 chapter 4: lpc800 system configuration (syscon) 4.5.3 configuration of reduced power-modes the system control block configures analog blocks that can remain running in the reduced power modes (the bod and the watchdog oscillator for safe operation) and enables various interrupts to wake up the chip when the internal clocks are shut down in deep-sleep and power-down modes. for details, see the fo llowing registers: section 4.6.32 ? power configuration register ? section 4.6.29 ? start logic 1 interrupt wake-up enable register ? 4.5.4 reset and interrupt control the peripheral reset control register in the s ystem control register allows to assert and release individual peripheral resets. see ta b l e 7 . up to eight external pin interrupts can be assigned to any digital pin in the system control block (see section 4.6.27 ? pin interrupt select registers ? ). 4.6 register description all system control block regi sters reside on word address boundaries. details of the registers appear in the description of each function. reset values describe the content of the regi sters after the boot loader has executed. all address offsets not shown in ta b l e 5 are reserved and should not be written. table 5. register overview: system configuration (base address 0x4004 8000) name access offset description reset value reference sysmemremap r/w 0x000 system memory remap 0x2 ta b l e 6 presetctrl r/w 0x004 peripheral reset control 0x0000 1fff ta b l e 7 syspllctrl r/w 0x008 system pll control 0 ta b l e 8 syspllstat r 0x00c system pll status 0 ta b l e 9 - - 0x010 reserved - - - - 0x014 reserved - - sysoscctrl r/w 0x020 system oscillator control 0x000 ta b l e 1 0 wdtoscctrl r/w 0x024 watchdog oscillator control 0x0a0 ta b l e 11 - - 0x028 reserved - - - - 0x02c reserved - - sysrststat r/w 0x030 system reset status register 0 ta b l e 1 2 syspllclksel r/w 0x040 system pll clock source select 0 ta b l e 1 3 syspllclkuen r/w 0x044 system pll clock source update enable 0 ta b l e 1 4 mainclksel r/w 0x070 main clock source select 0 ta b l e 1 5 mainclkuen r/w 0x074 main clock source update enable 0 ta b l e 1 6 sysahbclkdiv r/w 0x078 system clock divider 1 ta b l e 1 7 sysahbclkctrl r/w 0x080 system clock control 0x1f ta b l e 1 8 uartclkdiv r/w 0x094 usart clock divider 0 ta b l e 1 9 - - 0x098 reserved - -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 18 of 313 nxp semiconductors um10601 chapter 4: lpc800 system configuration (syscon) - - 0x09c reserved - - - - 0x0a0 - 0x0bc reserved - - - - 0x0cc reserved - - clkoutsel r/w 0x0e0 clkout clock source select 0 ta b l e 2 0 clkoutuen r/w 0x0e4 clkout clock source update enable 0 ta b l e 2 1 clkoutdiv r/w 0x0e8 clkout clock divider 0 ta b l e 2 2 uartfrgdiv r/w 0x0f0 usart fractional generator divider value 0 ta b l e 2 3 uartfrgmult r/w 0x0f4 usart fractional generator multiplier value 0 ta b l e 2 4 exttracecmd r/w 0x0fc external trace buffer command register 0 ta b l e 2 5 pioporcap0 r 0x100 por captured pio status 0 user dependent ta b l e 2 6 - - 0x104 reserved - - ioconclkdiv6 r/w 0x134 peripheral cl ock 6 to the iocon block for programmable glitch filter 0x0000 0000 ta b l e 2 7 ioconclkdiv5 r/w 0x138 peripheral cl ock 5 to the iocon block for programmable glitch filter 0x0000 0000 ta b l e 2 7 ioconclkdiv4 r/w 0x13c peripheral cl ock 4 to the iocon block for programmable glitch filter 0x0000 0000 ta b l e 2 7 ioconclkdiv3 r/w 0x140 peripheral cl ock 3 to the iocon block for programmable glitch filter 0x0000 0000 ta b l e 2 7 ioconclkdiv2 r/w 0x144 peripheral cl ock 2 to the iocon block for programmable glitch filter 0x0000 0000 ta b l e 2 7 ioconclkdiv1 r/w 0x148 peripheral cl ock 1 to the iocon block for programmable glitch filter 0x0000 0000 ta b l e 2 7 ioconclkdiv0 r/w 0x14c peripheral cl ock 0 to the iocon block for programmable glitch filter 0x0000 0000 ta b l e 2 7 bodctrl r/w 0x150 brown-out detect 0 ta b l e 2 8 systckcal r/w 0x154 system tick counter calibration 0x0 ta b l e 2 9 - r/w 0x168 reserved - - irqlatency r/w 0x170 iqr delay. allows trade-off between interrupt latency and determinism. 0x0000 0010 ta b l e 3 0 nmisrc r/w 0x174 nmi source control 0 ta b l e 3 1 pintsel0 r/w 0x178 gpio pin inte rrupt select register 0 0 ta b l e 3 2 pintsel1 r/w 0x17c gpio pin inte rrupt select register 1 0 ta b l e 3 2 pintsel2 r/w 0x180 gpio pin interrupt select register 2 0 ta b l e 3 2 pintsel3 r/w 0x184 gpio pin interrupt select register 3 0 ta b l e 3 2 pintsel4 r/w 0x188 gpio pin interrupt select register 4 0 ta b l e 3 2 pintsel5 r/w 0x18c gpio pin interrupt select register 5 0 ta b l e 3 2 pintsel6 r/w 0x190 gpio pin interrupt select register 6 0 ta b l e 3 2 pintsel7 r/w 0x194 gpio pin interrupt select register 7 0 ta b l e 3 2 starterp0 r/w 0x204 start logic 0 pin wake-up enable register 0 ta b l e 3 3 starterp1 r/w 0x214 start logic 1 interrupt wake-up enable register 0 ta b l e 3 4 table 5. register overview: system configuration (base address 0x4004 8000) ?continued name access offset description reset value reference
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 19 of 313 nxp semiconductors um10601 chapter 4: lpc800 system configuration (syscon) 4.6.1 system memory remap register the system memory remap register selects whether the exception vectors are read from boot rom, flash, or sram. by default, the flash memory is mapped to address 0x0000 0000. when the map bits in the sysmemremap register are set to 0x0 or 0x1, the boot rom or ram respectively are mapped to the bottom 512 bytes of the memory map (addresses 0x0000 0000 to 0x0000 0200). 4.6.2 peripheral reset control register the presetctrl register allows software to reset specific peripherals. a zero in any assigned bit in this register resets the specif ied peripheral. a 1 clears the reset and allows the peripheral to operate. pdsleepcfg r/w 0x230 power-down states in deep-sleep mode 0xffff ta b l e 3 5 pdawakecfg r/w 0x234 power-down states for wake-up from deep-sleep 0xedf0 ta b l e 3 6 pdruncfg r/w 0x238 power configuration register 0xedf0 ta b l e 3 7 device_id r 0x3f4 device id part dependent ta b l e 3 8 table 5. register overview: system configuration (base address 0x4004 8000) ?continued name access offset description reset value reference table 6. system memory remap register (sysmemremap, address 0x4004 8000) bit description bit symbol value description reset value 1:0 map system memory remap. value 0x3 is reserved. 0x2 0x0 boot loader mode. interrupt vectors are re-mapped to boot rom. 0x1 user ram mode. interrupt ve ctors are re-mapped to static ram. 0x2 user flash mode. interrupt vectors are not re-mapped and reside in flash. 31:2 - - reserved - table 7. peripheral reset control register (presetct rl, address 0x4004 8004) bit description bit symbol value description reset value 0 spi0_rst_n spi0 reset control 1 0 assert the spi0 reset. 1 clear the spi0 reset. 1 spi1_rst_n spi1 reset control 1 0 assert the spi1 reset. 1 clear the spi1 reset. 2 uartfrg_rst_n usart fractional baud rate generator (uartfrg) reset control 1 0 assert the uartfrg reset. 1 clear the uartfrg reset.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 20 of 313 nxp semiconductors um10601 chapter 4: lpc800 system configuration (syscon) 4.6.3 system pll control register this register connects and enables the system pll and configures the pll multiplier and divider values. the pll accepts an input frequency from 10 mhz to 25 mhz from various clock sources. the input frequency is multiplied to a higher frequency and then divided down to provide the actual clock used by the cpu, peripherals, and memories. the pll can produce a clock up to the maximum allowed for the cpu. 3 usart0_rst_n usart0 reset control 1 0 assert the usart0 reset. 1 clear the usart0 reset. 4 uart1_rst_n usart1 reset control 1 0 assert the usart reset. 1 clear the usart1 reset. 5 uart2_rst_n usart2 reset control 1 0 assert the usart2 reset. 1 clear the usart2 reset. 6 i2c_rst_n i2c reset control 1 0 assert the i2c reset. 1 clear the i2c reset. 7 mrt_rst_n multi-rate timer (mrt) reset control 1 0 assert the mrt reset. 1 clear the mrt reset. 8 sct_rst_n sct reset control 1 0 assert the sct reset. 1 clear the sct reset. 9 wkt_rst_n self wake-up timer (wkt) reset control 1 0 assert the wkt reset. 1 clear the wkt reset. 10 gpio_rst_n gpio and gpio pin interrupt reset control 1 0 assert the gpio reset. 1 clear the gpio reset. 11 flash_rst_n flash co ntroller reset control 1 0 assert the flash controller reset. 1 clear the flash controller reset. 12 acmp_rst_n analog comparator reset control 1 0 assert the analog comparator reset. 1 clear the analog comparator controller reset. 31:12 - - reserved - table 7. peripheral reset control register (presetct rl, address 0x4004 8004) bit description bit symbol value description reset value
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 21 of 313 nxp semiconductors um10601 chapter 4: lpc800 system configuration (syscon) 4.6.4 system pll status register this register is a read-only register and supplies the pll lock status (see ). 4.6.5 system oscillator control register this register conf igures the freque ncy range for the system oscillator. table 8. system pll control register (syspllctrl, addres s 0x4004 8008) bit description bit symbol value description reset value 4:0 msel feedback divider value. the division value m is the programmed msel value + 1. 00000: division ratio m = 1 to 11111: division ratio m = 32 0 6:5 psel post divider ratio p. the division ratio is 2 ? p. 0 0x0 p = 1 0x1 p = 2 0x2 p = 4 0x3 p = 8 31:7 - - reserved. do not write ones to reserved bits. - table 9. system pll status register (sysplls tat, address 0x4004 800c) bit description bit symbol value description reset value 0 lock pll lock status 0 0 pll not locked 1 pll locked 31:1 - - reserved - table 10. system oscillator control register (sysoscctrl , address 0x40 04 8020) bit description bit symbol value description reset value 0 bypass bypass system oscillator 0x0 0 disabled. oscillator is not bypassed. 1 enabled. pll input (sys_osc_clk) is fed directly from the xtalin pin bypassing the oscillator. use this mode when using an external clock source instead of the crystal oscillator. 1 freqrange determines frequency range for low-power oscillator. 0x0 0 1 - 20 mhz frequency range. 1 15 - 25 mhz frequency range 31:2 - - reserved 0x00
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 22 of 313 nxp semiconductors um10601 chapter 4: lpc800 system configuration (syscon) 4.6.6 watchdog oscillator control register this register configures the watchdog oscillator. the osc illator consists of an analog and a digital part. the analog part contains the osc illator function and gene rates an analog clock (fclkana). with the digital part, the analog output clock (fclkana) can be divided to the required output clock frequency wdt_osc_clk. the analog output frequency (fclkana) can be adjusted with the freqsel bits between 6 00 khz and 4.6 mhz. with the digital part fclkana will be divided (divider ratios = 2, 4,...,64) to wd t_osc_clk using the divsel bits. the output clock fr equency of the watchdog osc illator can be calculated as wdt_osc_clk = fclkana/(2 ? (1 + divsel)) = 9.3 khz to 2.3 mhz (nominal values). remark: any setting of the freqsel bits will yield a fclkana value within ? 40% of the listed frequency value. the wa tchdog oscillator is the clock source with the lowest power consumption. if accura te timing is required, use the irc or system oscillator. remark: the frequency of the watchd og oscillator is undefined after reset. the watchdog oscillator frequency must be programmed by writing to the wdtoscctrl register before using the watchdog oscillator. table 11. watchdog oscillator control regi ster (wdtoscctrl, address 0x4004 8024) bit description bit symbol value description reset value 4:0 divsel select divider for fclkana. wdt_osc_clk = fclkana/ (2 ? (1 + divsel)) 00000: 2 ? (1 + divsel) = 2 00001: 2 ? (1 + divsel) = 4 to 11111: 2 ? (1 + divsel) = 64 0 8:5 freqsel select watchdog osc illator analog output frequency (fclkana). 0x00 0x1 0.6 mhz 0x2 1.05 mhz 0x3 1.4 mhz 0x4 1.75 mhz 0x5 2.1 mhz 0x6 2.4 mhz 0x7 2.7 mhz 0x8 3.0 mhz 0x9 3.25 mhz 0xa 3.5 mhz 0xb 3.75 mhz 0xc 4.0 mhz 0xd 4.2 mhz 0xe 4.4 mhz 0xf 4.6 mhz 31:9 - - reserved 0x00
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 23 of 313 nxp semiconductors um10601 chapter 4: lpc800 system configuration (syscon) 4.6.7 system reset status register the sysrststat register shows the source of the latest reset event. the bits are cleared by writing a one to any of the bits. the por event clears all other bits in this register. if another reset signal - for example the external reset pin - remains asserted after the por signal is negated, then its bit is set to detected. write a one to clear the reset. the reset value given in ta b l e 1 2 applies to th e por reset. 4.6.8 system pll clock so urce select register this register selects the cl ock source for the system p ll. the syspllclkuen register (see section 4.6.9 ) must be toggled from low to high for the update to take effect. table 12. system reset status register (sys rststat, address 0x4004 8030) bit description bit symbol value description reset value 0 por por reset status 0 0 no por detected 1 por detected. writing a one clears this reset. 1 extrst status of the external reset pin. external reset status. 0 0 no reset event detected. 1 reset detected. writing a one clears this reset. 2 wdt status of the watchdog reset 0 0 no wdt reset detected 1 wdt reset detected. writing a one clears this reset. 3 bod status of the brown-out detect reset 0 0 no bod reset detected 1 bod reset detected. writin g a one clears this reset. 4 sysrst status of the software system reset 0 0 no system reset detected 1 system reset detected. writing a one clears this reset. 31:5 - - reserved - table 13. system pll clock source select register (syspllclksel, address 0x4004 8040) bit description bit symbol value description reset value 1:0 sel system pll clock source 0 0x0 irc 0x1 crystal oscillator (sysosc) 0x2 reserved. 0x3 clkin. external clock input. 31:2 - - reserved -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 24 of 313 nxp semiconductors um10601 chapter 4: lpc800 system configuration (syscon) 4.6.9 system pll clock source update register this register updates the clock source of t he system pll with the new input clock after the syspllclksel register has been wr itten to. in order for the upd ate to take effect, first write a zero to the sysplluen register and then write a one to sysplluen. 4.6.10 main clock source select register this register selects the main system clock, which can be the system pll (sys_pllclkout), or the watchdog oscillator, or the irc osc illator. the main system clock clocks the core, the peripherals, and the memories. bit 0 of the mainclkuen register (see section 4.6.11 ) must be toggled from 0 to 1 for the update to take effect. 4.6.11 main clock source update enable register this register updates the cloc k source of the main clock with the new input clock after the mainclksel register has been written to. in order for the update to take effect, first write a zero to bit 0 of this register, then write a one. table 14. system pll clock source update enable regist er (syspllclkuen, address 0x4004 8044) bit description bit symbol value description reset value 0 ena enable system pll clock source update 0 0 no change 1 update clock source 31:1 - - reserved - table 15. main clock source select regist er (mainclksel, address 0x4004 8070) bit description bit symbol value description reset value 1:0 sel clock source for main clock 0 0x0 irc oscillator 0x1 pll input 0x2 watchdog oscillator 0x3 pll output 31:2 - - reserved - table 16. main clock source update enable register (mainclkuen, address 0x4004 8074) bit description bit symbol value description reset value 0 ena enable main clock source update 0 0 no change 1 update clock source 31:1 - - reserved -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 25 of 313 nxp semiconductors um10601 chapter 4: lpc800 system configuration (syscon) 4.6.12 system clock divider register this register controls how the main clock is divided to provide the system clock to the core, memories, and the peripherals. the syst em clock can be shut down completely by setting the div field to zero. 4.6.13 system clock control register the sysahbclkctrl register enables the cl ocks to individual system and peripheral blocks. the system clock (bit 0) provides th e clock for the ahb, the apb bridge, the arm cortex-m0+, the syscon bloc k, and the pmu. this cl ock cannot be disabled. table 17. system clock divi der register (sysahbclkdiv, address 0x4004 8078) bit description bit symbol description reset value 7:0 div system ahb clock divider values 0: system clock disabled. 1: divide by 1. to 255: divide by 255. 0x01 31:8 - reserved - table 18. system clock control register (sysahbclkctrl, address 0x4004 8080) bit description bit symbol value description reset value 0 sys enables the clock for the ahb, the apb bridge, the cortex-m0+ core clocks, syscon, and the pmu. this bit is read only and always reads as 1. 1 0 reserved 1 enable 1 rom enables clock for rom. 1 0 disable 1 enable 2 ram enables clock for sram. 1 0 disable 1 enable 3 flashreg enables clock for flash register interface. 1 0 disable 1 enable 4 flash enables clock for flash. 1 0 disable 1 enable 5 i2c enables clock for i2c. 0 0 disable 1 enable
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 26 of 313 nxp semiconductors um10601 chapter 4: lpc800 system configuration (syscon) 6 gpio enables clock for gpio port registers and gpio pin interrupt registers. 0 0 disable 1 enable 7 swm enables clock for switch matrix. 0 0 disable 1 enable 8 sct enables clock for state configurable timer. 0 0 disable 1 enable 9 wkt enables clock for self wake-up timer. 0 0 disable 1 enable 10 mrt enables clock for multi-rate timer. 0 disable 1 enable 11 spi0 enables clock for spi0. 0 0 disable 1 enable 12 spi1 enables clock for spi1. 0 disable 1 enable 13 crc enables clock for crc. 0 0 disable 1 enable 14 uart0 enables clock for usart0. 0 0 disable 1 enable 15 uart1 enables clock for usart1. 0 0 disable 1 enable 16 uart2 enables clock for usart2. 0 0 disable 1 enable 17 wwdt enables clock for wwdt. 0 0 disable 1 enable 18 iocon enables clock for iocon block. 0 0 disable 1 enable table 18. system clock control register (sysahbclkctrl, address 0x4004 8080) bit description ?continued bit symbol value description reset value
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 27 of 313 nxp semiconductors um10601 chapter 4: lpc800 system configuration (syscon) 4.6.14 usart clock divider register this register configures the clock for the fr actional baud rate generator and all usarts. the uart clock can be disabled by setting the div field to zero (this is the default setting). 4.6.15 clkout clock source select register this register selects the signal visible on the clkout pin. any oscillator or the main clock can be selected. bit 0 of the clkoutuen register (see section 4.6.16 ) must be toggled from 0 to 1 for the update to take effect. 4.6.16 clkout clock source update enable register this register updates the clock source of the clkout pin with the new clock after the clkoutsel register has been written to. in order for the update to take effect at the input of the clkout pin, first write a zero to bit 0 of this register, then write a one. 19 acmp enables clock to analog comparator. 0 0 disable 1 enable 31:20 - - reserved - table 18. system clock control register (sysahbclkctrl, address 0x4004 8080) bit description ?continued bit symbol value description reset value table 19. usart clock di vider register (uartclkdiv, addr ess 0x4004 8094) bit description bit symbol description reset value 7:0 div usart clock divider values. 0: clock disabled. 1: divide by 1. to 255: divide by 255. 0 31:8 - reserved - table 20. clkout clock source select regist er (clkoutsel, address 0x4004 80e0) bit description bit symbol value description reset value 1:0 sel clkout clock source 0 0x0 irc oscillator 0x1 crystal oscillator (sysosc) 0x2 watchdog oscillator 0x3 main clock 31:2 - - reserved 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 28 of 313 nxp semiconductors um10601 chapter 4: lpc800 system configuration (syscon) 4.6.17 clkout clock divider register this register determines the divider value for the signal on the clkout pin. 4.6.18 usart fractional genera tor divider value register all usart peripherals share a common clock u_pclk, which can be adjusted by a fractional divider: u_pclk = uartclkdiv/(1 + mult/div). uartclkdiv is the usart clock configured in the uartclkdiv register. the fractional portion (1 + mult/div) is det ermined by the two usart fractional divider registers in the syscon block: 1. the div value programmed in this register is the denominator of the divider used by the fractional rate generator to creat e the fractional component of u_pclk. 2. the mult value of the fractional di vider is programmed in the uartfrgmult register. see ta b l e 2 4 . remark: to use of the fractional baud rate generato r, you must write 0xff to this register to yield a denominator value of 256. all other values are not supported. see also: section 15.3.1 ? configure the usart clock and baud rate ? section 15.7.1 ? clocking and baud rates ? table 21. clkout clock source update enable register (clkoutuen, address 0x4004 80e4) bit description bit symbol value description reset value 0 ena enable clkout clock source update 0 0 no change 1 update clock source 31:1 - - reserved - table 22. clkout clock divider registers (clkoutdiv, address 0x4004 80e8) bit description bit symbol description reset value 7:0 div clkout clock divider values 0: disable clkout clock divider. 1: divide by 1. to 255: divide by 255. 0 31:8 - reserved -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 29 of 313 nxp semiconductors um10601 chapter 4: lpc800 system configuration (syscon) 4.6.19 usart fractional generato r multiplier value register all usart peripherals share a common clock u_pclk, which can be adjusted by a fractional divider: u_pclk = uartclkdiv/(1 + mult/div). uartclkdiv is the usart clock configured in the uartclkdiv register. the fractional portion (1 + mult/div) is det ermined by the two usart fractional divider registers in the syscon block: 1. the div denominator of the fractiona l divider value is programmed in the uartfrgdiv register. see ta b l e 2 3 . 2. the mult value programmed in this register is the numerator of the fractional divider value used by the fractional rate generator to create the fraction al component to the baud rate. see also: section 15.3.1 ? configure the usart clock and baud rate ? section 15.7.1 ? clocking and baud rates ? 4.6.20 external trace buffer command register table 23. usart fractional generator divider value register (uartfrgdiv, address 0x4004 80f0) bit description bit symbol description reset value 7:0 div denominator of the fractional divi der. div is equal to the programmed value +1. always set to 0xff to use with the fractional baud rate generator. 0 31:8 - reserved - table 24. usart fractional generator multipli er value register (uartfrgmult, address 0x4004 80f4) bit description bit symbol description reset value 7:0 mult numerator of the fractional divi der. mult is equal to the programmed value. 0 31:8 - reserved - table 25. external trace buffer command register (exttracecmd, address 0x4004 80fc) bit description bit symbol description reset value 0 start trace start command 0 1 stop trace stop command 0 31:2 - reserved 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 30 of 313 nxp semiconductors um10601 chapter 4: lpc800 system configuration (syscon) 4.6.21 por captured pio status register 0 the pioporcap0 register captur es the state of gpio port 0 at power-on-reset. each bit represents the reset state of one gpio pin. this register is a read-only status register. 4.6.22 iocon glitch filter cl ock divider registers 6 to 0 these registers individually configur e the seven peripheral input clocks (ioconfiltr_pclk) to the iocon programmable glitch filter. the clocks can be shut down by setting the div bits to 0x0. 4.6.23 bod control register the bod control register selects four sepa rate threshold values for sending a bod interrupt to the nvic and for forced reset. re set and interrupt threshold values listed in ta b l e 2 8 are typical values. both the bod interrupt and the bod reset, dep ending on the value of bit bodrstena in this register, can wake-up the chip from sl eep, deep-sleep, and power-down modes. see . table 26. por captured pio status regist er 0 (pioporcap0, address 0x4004 8100) bit description bit symbol description reset value 17:0 piostat state of pio0_17 through pi o0_0 at power-on reset implementation dependent 31:18 - reserved. - table 27. iocon glitch filter clock divider registers 6 to 0 (ioconclkdiv[6:0], address 0x4004 8134 (ioconclkdiv6) to 0x00 4 814c (ioconfiltclkdiv0)) bit description bit symbol description reset value 7:0 div iocon glitch filter clock divider values 0: disable ioconfiltr_pclk. 1: divide by 1. to 255: divide by 255. 0 31:8 - reserved 0x00 table 28. bod control register (bodctrl, address 0x4004 8150) bit description bit symbol value description reset value 1:0 bodrstlev bod reset level 0 0x0 level 0: the reset assertion threshold voltage is ; the reset de-assertion threshold voltage is . 0x1 level 1: the reset assertion threshold voltage is ; the reset de-assertion threshold voltage is . 0x2 level 2: the reset assertion threshold voltage is ; the reset de-assertion threshold voltage is . 0x3 level 3: the reset assertion threshold voltage is ; the reset de-assertion threshold voltage is.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 31 of 313 nxp semiconductors um10601 chapter 4: lpc800 system configuration (syscon) 4.6.24 system tick count er calibration register this register determines the va lue of the syst_calib register. 4.6.25 irq late ncy register the irqlatency register is an eight-bit regi ster which specifies the minimum number of cycles (0-255) permitted for the system to respond to an interr upt request. the intent of this register is to allow the user to select a trade-off between interrupt response time and determinism. setting this parameter to a very low valu e (e.g. zero) will guarant ee the best possible interrupt performance but will al so introduce a signifi cant degree of unce rtainty and jitter. requiring the system to always ta ke a larger number of cycles (whether it needs it or not) will reduce the amount of uncertainty bu t may not necessarily eliminate it. theoretically, the arm cortex-m0 core should always be able to service an interrupt request within 15 cycles. system factors external to the cpu, however, bus latencies, peripheral response times, etc. can increase the time required to complete a previous instruction before an interrupt can be serv iced. therefore, accurately specifying a minimum number of cycles that will ensure determinism will depend on the application. the default setting for this register is 0x010. 3:2 bodintval bod interrupt level 0 0x0 level 0: the interrupt assertion threshold voltage is ; the interrupt de-assertion threshold voltage is 0x1 level 1: the interrupt assertion threshold voltage is ; the interrupt de-assertion threshold voltage is . 0x2 level 2: the interrupt assertion threshold voltage is ; the interrupt de-assertion threshold voltage is . 0x3 level 3: the interrupt assertion threshold voltage is ; the interrupt de-assertion threshold voltage is . 4 bodrstena bod reset enable 0 0 disable reset function. 1 enable reset function. 31:5 - - reserved 0x00 table 28. bod control register (bodctrl, address 0x4004 8150) bit description bit symbol value description reset value table 29. system tick timer ca libration register (systckcal , address 0x4004 8154) bit description bit symbol description reset value 25:0 cal system tick timer calibration value 0 31:26 - reserved -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 32 of 313 nxp semiconductors um10601 chapter 4: lpc800 system configuration (syscon) 4.6.26 nmi source selection register the nmi source selection register selects a peripheral interrupts as source for the nmi interrupt of the arm cortex-m0+ core. for a list of all peripheral interrupts and their irq numbers see . for a description of the nmi functionality, see . note: if the nmisrc register is used to select an interrupt as the source of non-maskable interrupts, and the selected interrupt is enabled, one interrupt request can result in both a non-maskable and a normal interrupt. this can be avoided by disabling the normal interrupt in the nvic, as described in . 4.6.27 pin interrupt select registers each of these 8 registers selects one pin from all digital pins as the source of a pin interrupt or as the input to the pattern match e ngine. to select a pin for any of the eight pin interrupts or pattern match engine inputs, writ e the gpio port pin number as 0 to 17 for pins pio0_0 to pio0_17 to the intpin bits . for example, setting intpin to 0x5 in pintsel0 selects pin pio0_5 for pin interrupt 0. to determine the gpio port pin number on a given lpc800 package, see the pin description table in the data sheet. remark: the gpio port pin number serves to id entify the pin to the pintsel register. any digital function, including gpio, can be assigned to this pin through the switch matrix. each of the 8 pin interrupts must be enabled in the nvic using interrupt slots # 24 to 31 (see table 3 ). to use the selected pins for pin interr upts or the pattern match engine, see section 8.5.2 ? pattern match engine ? . table 30. irq latency register (irqlatency, address 0x4004 8170) bit description bit symbol description reset value 7:0 latency 8-bit latency value 0x010 31:8 - reserved - table 31. nmi source selection register (nmisrc, address 0x4004 8174) bit description bit symbol description reset value 4:0 irqno the irq number of the interrupt that acts as the non-maskable interrupt (nmi) if bit 31 is 1. see table 3 for the list of interrupt sources and their irq numbers. 0 30:5 - reserved - 31 nmien write a 1 to this bit to enable the non-maskable interrupt (nmi) source selected by bits 4:0. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 33 of 313 nxp semiconductors um10601 chapter 4: lpc800 system configuration (syscon) 4.6.28 start logic 0 pin wake-up enable register the starterp0 register enables the selected pin interrupts for wake-up from deep-sleep mode and power-down modes. remark: also enable the corresponding interrupts in the nvic. see ta b l e 3 ? connection of interrupt sources to the nvic ? . table 32. pin interrupt select registers (pint sel[0:7], address 0x4004 8178 (pintsel0) to 0x4004 8194 (pintsel7)) bit description bit symbol description reset value 5:0 intpin pin number select for pin in terrupt or pattern match engine input. (pio0_0 to pio0_17 correspond to numbers 0 to 17). 0 31:6 - reserved - table 33. start logic 0 pin wake-up enable register 0 (starterp0, address 0x4004 8204) bit description bit symbol value description reset value 0 pint0 gpio pin in terrupt 0 wake-up 0 0 disabled 1 enabled 1 pint1 gpio pin in terrupt 1 wake-up 0 0 disabled 1 enabled 2 pint2 gpio pin in terrupt 2 wake-up 0 0 disabled 1 enabled 3 pint3 gpio pin in terrupt 3 wake-up 0 0 disabled 1 enabled 4 pint4 gpio pin in terrupt 4 wake-up 0 0 disabled 1 enabled 5 pint5 gpio pin in terrupt 5 wake-up 0 0 disabled 1 enabled 6 pint6 gpio pin in terrupt 6 wake-up 0 0 disabled 1 enabled 7 pint7 gpio pin in terrupt 7 wake-up 0 0 disabled 1 enabled 31:8 - reserved -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 34 of 313 nxp semiconductors um10601 chapter 4: lpc800 system configuration (syscon) 4.6.29 start logic 1 interrupt wake-up enable register this register selects which interrupts wake the lpc800 from deep-sleep and power-down modes. remark: also enable the corresponding interrupts in the nvic. see ta b l e 3 ? connection of interrupt sources to the nvic ? . table 34. start logic 1 interrupt wake-up enable register (starterp1, address 0x4004 8214) bit description bit symbol value description reset value 0 spi0 spi0 interrupt wake-up 0 0 disabled 1 enabled 1 spi1 spi1 interrupt wake-up 0 0 disabled 1 enabled 2 - reserved - 3 usart0 usart0 interrupt wake-up. configure usart in synchronous slave mode. 0 0 disabled 1 enabled 4 usart1 usart1 interrupt wake-up. configure usart in synchronous slave mode. 0 0 disabled 1 enabled 5 usart2 usart2 interrupt wake-up. configure usart in synchronous slave mode. 0 0 disabled 1 enabled 7:6 - reserved - 8 i2c i2c interrupt wake-up. 0 0 disabled 1 enabled 11:9 - reserved - 12 wwdt wwdt interrupt wake-up 0 0 disabled 1 enabled 13 bod bod interrupt wake-up 0 0 disabled 1 enabled 14 - reserved -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 35 of 313 nxp semiconductors um10601 chapter 4: lpc800 system configuration (syscon) 4.6.30 deep-sleep mode configuration register the bits in this register (bod_pd and wdtosc_od) can be programmed to control aspects of deep-sleep and power-down modes. the bits are loaded into corresponding bits of the pdruncfg register when deep-sleep mode or po wer-down mode is entered. remark: hardware forces the analog blocks to be powered down in deep-sleep and power-down modes. an exception are the ex ception of bod and watchdog oscillator, which can be configured to remain running through this register. the wdtosc_pd value written to the pdsleepcfg regi ster is overwritten if t he lock bit in the wwdt mod register (see table 142 ) is set. see section 12.5.3 for details. 4.6.31 wake-up confi guration register this register controls the power configurat ion of the device when waking up from deep-sleep or po wer-down mode. 15 wkt self wake-up time r interrupt wake-up 0 0 disabled 1 enabled 31:16 reserved. - table 34. start logic 1 interrupt wake-up enable register (starterp1, address 0x4004 8214) bit description ?continued bit symbol value description reset value table 35. deep-sleep configuration regist er (pdsleepcfg, address 0x4004 8230) bit description bit symbol value description reset value 2:0 reserved. 0b111 3 bod_pd bod power-down control for deep-sleep and power-down mode 1 0 powered 1 powered down 5:4 reserved. 11 6 wdtosc_pd watchdog oscillator power-down control for deep-sleep and power-down mode. changing this bit to powered-down has no effect when the lock bit in the wwdt mod register is set. in this case, the watchdog oscillator is always running. 1 0 powered 1 powered down 15:7 - reserved 0b111111111 31:7 - - reserved 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 36 of 313 nxp semiconductors um10601 chapter 4: lpc800 system configuration (syscon) 4.6.32 power configuration register the pdruncfg register controls the power to the various an alog blocks. this register can be written to at any time while the ch ip is running, and a write will take effect immediately with the exception of th e power-down signal to the irc. to avoid glitches when powering down the irc, the irc clock is automa tically switched off at a clean point. therefore, for the irc a delay is possible before the power-down state takes effect. table 36. wake-up configuration register (pdawakecfg, address 0x4004 8234) bit description bit symbol value description reset value 0 ircout_pd irc oscillator out put wake-up configuration 0 0 powered 1 powered down 1 irc_pd irc oscillator power-down wake-up configuration 0 0 powered 1 powered down 2 flash_pd flash wake-up configuration 0 0 powered 1 powered down 3 bod_pd bod wake-up configuration 0 0 powered 1 powered down 4 - reserved. 1 5 sysosc_pd crystal oscillator wake-up configuration 1 0 powered 1 powered down 6 wdtosc_pd watchdog oscillator wake-up configuration. changing this bit to powered-down has no effect when the lock bit in the wwdt mod register is set. in this case , the watchdog oscillator is always running. 1 0 powered 1 powered down 7 syspll_pd system pll wa ke-up configuration 1 0 powered 1 powered down 11:8 - reserved. always write these bits as 0b1101 0b1101 14:12 - reserved. always write these bits as 0b110 0b110 15 acmp analog comparator wake-up configuration 1 0 powered 1 powered down 31:16 - - reserved 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 37 of 313 nxp semiconductors um10601 chapter 4: lpc800 system configuration (syscon) 4.6.33 device id register this device id register is a read-only regist er and contains the part id for each lpc800 part. this register is also re ad by the isp/iap commands (see table 229 ). table 37. power configuration register (pdruncf g, address 0x4004 8238) bit description bit symbol value description reset value 0 ircout_pd irc oscillator output power 0 0 powered 1 powered down 1 irc_pd irc oscillator power down 0 0 powered 1 powered down 2 flash_pd flash power down 0 0 powered 1 powered down 3 bod_pd bod power down 0 0 powered 1 powered down 4 - reserved. 1 5 sysosc_pd crystal oscillator power down 1 0 powered 1 powered down 6 wdtosc_pd watchdog oscillator power down. changing this bit to powered-down has no effect when the lock bit in the wwdt mod register is set. in this case, the watchdog oscillator is always running. 1 0 powered 1 powered down 7 syspll_pd system pll power down 1 0 powered 1 powered down 11:8 - reserved. always write these bits as 0b1101 0b1101 14:12 - reserved. always write these bits as 0b110 0b110 15 acmp analog comparator power down 1 0 powered 1 powered down 31:16 - - reserved 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 38 of 313 nxp semiconductors um10601 chapter 4: lpc800 system configuration (syscon) 4.7 functional description 4.7.1 system pll f unctional description the lpc800 uses the system pll to create the clocks for the core and peripherals. the block diagram of this pll is shown in figure 4 . the input frequency range is 10 mhz to 25 mhz. the input clock is fed directly to the phase-frequency detector (pfd). this block compares the phase and frequency of its inputs, and generates a control signal when phase and/ or frequency do not match. t he loop filter filters these control signals and drives the current contro lled oscillator (cco), which ge nerates the ma in clock and optionally two additional phases. the cco frequency range is 156 mhz to 320 mhz. these clocks are either divided by 2 ? p by the programmable post divider to create the output clocks, or are sent directly to the outp uts. the main output clock is then divided by m by the programmable feedback divider to generate the feedback clock. the output signal of the phase-frequency detector is also monitored by the lock detector, to signal when the pll has locked on to the input clock. table 38. device id register (device_id, address 0x4004 83f4) bit description bit symbol description reset value 31:0 deviceid 0x0000 8100 = lpc810m021fn8 0x0000 8110 = lpc811m001fdh16 0x0000 8120 = lpc812m101fdh16 0x0000 8121 = lpc812m101fd20 0x0000 8122 = LPC812M101FDH20 part-dependent fig 4. system pll block diagram      5' %&%"#=
$+!(6#& 5' !'   !' f0,g 5'  f 0,g 8 6)!-#$!-!" $d$-#$!-!"      
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 39 of 313 nxp semiconductors um10601 chapter 4: lpc800 system configuration (syscon) 4.7.1.1 lock detector the lock detector measures the phase differen ce between the rising edges of the input and feedback clocks. only when this difference is smaller than the so called ?lock criterion? for more than eight consecutive i nput clock periods, the lock output switches from low to high. a single too large phase difference immediately resets the counter and causes the lock signal to drop (if it was high). requiring eight phase measurements in a row to be below a certain figure ensures that the lock detector will no t indicate lock until both the phase and frequency of the input and feedback clocks are very well aligned. this effectively prevents false lock indications, and thus ensures a glitch free lock signal. 4.7.1.2 power-down control to reduce the power consumption when th e pll clock is not needed, a power-down mode has been incorporated. this mode is enabled by setting the syspll_pd bit to one in the power-down configuration register ( ta b l e 3 7 ). in this mode, th e internal current reference will be turned off, the oscillato r and the phase-fre quency detector will be stopped and the dividers will enter a reset st ate. while in power- down mode, the lock output will be low to indicate that the pll is not in lock. when th e power-down mode is terminated by setting the syspll_pd bit to zero, the pll will resume its normal operation and will make the lock signal high on ce it has regained lo ck on the input clock. 4.7.1.3 divider ratio programming 4.7.1.3.1 post divider the division ratio of the post divider is controlled by the psel bits. the division ratio is two times the value of p selected by psel bits as shown in ta b l e 8 . this guarantees an output clock with a 50% duty cycle. 4.7.1.3.2 feedback divider the feedback divider?s division ratio is cont rolled by the msel bits. the division ratio between the pll?s output clock and the input cl ock is the decimal value on msel bits plus one, as specified in table 8 . 4.7.1.3.3 changing the divider values changing the divider ratio while the pll is running is not recommended. as there is no way to synchronize the change of the msel and psel values with the dividers, the risk exists that the counter will read in an undef ined value, which coul d lead to unwanted spikes or drops in the frequency of the ou tput clock. the recommended way of changing between divider settings is to power down the pl l, adjust the divider settings and then let the pll start up again. 4.7.1.4 frequency selection the pll frequency equations use the following parameters (also see figure 4 ): table 39. pll frequency parameters parameter system pll fclkin frequency of sys_pllclkin (input clock to the system pll) from the syspllclksel multiplexer (see section 4.6.8 ). fcco frequency of the current controll ed oscillator (cco); 156 to 320 mhz.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 40 of 313 nxp semiconductors um10601 chapter 4: lpc800 system configuration (syscon) 4.7.1.4.1 normal mode in this mode the post divider is enabled, giving a 50% duty cycle clock with the following frequency relations: (1) to select the appropriate values for m and p, it is recommended to follow these steps: 1. specify the input clock frequency fclkin. 2. calculate m to obtain the desired ou tput frequency fclkout with m = f clkout / f clkin . 3. find a value so that fcco = 2 ? p ? f clkout . 4. verify that all frequencies and divider va lues conform to the limits specified in table 8 . ta b l e 4 0 shows how to configure the pll for a 12 mhz crystal oscillator using the syspllctrl register ( ta b l e 8 ). the main clock is equivale nt to the system clock if the system clock divider sysahbclk div is set to one (see table 17 ). 4.7.1.4.2 power-down mode in this mode, the internal current reference will be turned off, the oscillator and the phase-frequency detector will be stoppe d and the dividers will ente r a reset state. while in power-down mode, the lock output will be low, to indicate that the pll is not in lock. when the power-down mode is terminated by syspll_pd bit to zero in the power-down configuration register ( table 37 ), the pll will resume its no rmal operation and will make the lock signal high once it has regained lock on the input clock. fclkout frequency of sys_pllclkout p system pll post divider ratio; psel bits in syspllctrl (see section 4.6.3 ). m system pll feedback divider regist er; msel bits in syspllctrl (see section 4.6.3 ). table 39. pll frequency parameters parameter system pll table 40. pll configuration examples pll input clock sys_pllclkin (fclkin) main clock (fclkout) msel bits table 8 m divider value psel bits table 8 p divider value fcco frequency 12 mhz 48 mhz 00011(binary) 4 01 (binary) 2 192 mhz 12 mhz 36 mhz 00010(binary) 3 10 (binary) 4 288 mhz 12 mhz 24 mhz 00001(binary) 2 10 (binary) 4 192 mhz fclkout m fclkin ? fcco ?? 2p ? ?? ? ==
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 41 of 313 5.1 how to read this chapter the lpc800 provides an on-chip api in the boot rom to optimize power consumption in active and sleep modes. see table 247 ? power profile api calls ? . read this chapter to configure the reduced power modes deep-sleep mode, power-down mode, and deep power-down mode. 5.2 features ? reduced power modes control ? low-power oscillator control ? four general purpose backup registers to retain data in deep power-down mode 5.3 basic configuration the pmu is always on as long as v dd is present. 5.4 pin description the lpc800 has no configur able pins. in deep power-dow n only the wakeup pin (pin pio0_4) is functi onal. the wakeup function can be disabled in th e dpdctrl register to lower the power consumption even more. in this case enable the self wake-up timer to provide an internal wake-up signal. see section 5.6.3 ? deep power-down control register ? . remark: when entering deep power-down mode, an external pull-up resistor is required on the wakeup pin to hold it high. pull the reset pin high to prev ent it from floating while in deep po wer-down mode. 5.5 general description power on the lpc800 is cont rolled by the pmu, by the syscon block, and the arm cortex-m0+ core. the following reduced power modes are supported in order from highest to lowest power consumption: 1. sleep mode: the sleep mode affects the arm cortex-m0 core only. peripherals and memories are active. 2. deep-sleep and power-down modes: the deep-sleep and power-down modes affect the core and the entire system with memories and peripherals. um10601 chapter 5: lpc800 reduced power modes and power management unit (pmu) rev. 1.0 ? 7 november 2012 preliminary user manual
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 42 of 313 nxp semiconductors um10601 chapter 5: lpc800 reduced power modes and power management a. in deep-sleep mode, the peripherals receive no internal clocks. memories are in stand-by mode. all registers maintain their internal states. the wwdt, wkt, and bod can remain active to wake up the system on an interrupt. b. in power-down mode, the peripherals re ceive no internal clocks. all registers maintain their internal states. the flash memory is powered down. the wwdt, wkt, and bod can remain active to wake up the system on an interrupt. 3. deep power-down mode: for maximal power savings, the entire system is shut down except for the general purpose registers in the pmu and the self wa ke-up timer. all registers maintain their internal states. the part can wake up on a pulse on the wakeup pin or when the self wake-up timer times out. on wa ke-up, the part reboots. remark: the lpc800 is in active mode when it is fully powered and operational after booting. 5.5.1 wake-up process if the part receives a wake-up signal in any of the reduced power modes, it wakes up to the active mode. see these links for related registers and wake-up instructions: ? to configure the system after wake-up: table 36 ? wake-up configuration register (pdawakecfg, address 0x4004 8234) bit description ? . ? to use external interrupts for wake-up: table 33 ? start logic 0 pin wake-up enable register 0 (starterp0, address 0x4004 8204) bit description ? and table 32 ? pin interrupt select registers (pintsel[0:7], address 0x4004 8178 (pintsel0) to 0x4004 8194 (pintsel7)) bit description ? ? to enable external or internal signals to wake up the part from deep-sleep or power-down modes: table 34 ? start logic 1 interrupt wake-up enable register (starterp1, address 0x4004 8214) bit description ? ? to configure the usart to wake up the part: section 15.3.2 ? configure the usart for wake-up ? ? for configuring the self wake-up timer: section 14.5 ? for a list of all wake-up sources: table 41 ? wake-up sources for reduced power modes ?
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 43 of 313 nxp semiconductors um10601 chapter 5: lpc800 reduced power modes and power management 5.6 register description table 41. wake-up sources for reduced power modes power mode wake-up source conditions sleep any interrupt enable interrupt in nvic. deep-sleep and power-down pin interrupts enable pin interrupts in nvic and starterp0 registers. bod interrupt ? enable interrupt in nvic and starterp1 registers. ? enable interrupt in bodctrl register. ? bod powered in pdsleepcfg register. bod reset ? enable reset in bodctrl register. ? bod powered in pdsleepcfg register. wwdt interrupt ? enable interrupt in nvic and starterp1 registers. ? wwdt running. enable wwdt in wwdt mod register and feed. ? enable interrupt in wwdt mod register. ? wdosc powered in pd sleepcfg register. wwdt reset ? wwdt running. ? enable reset in wwdt mod register. ? wdosc powered in pd sleepcfg register. self wake-up timer (wkt) time-out ? enable interrupt in nvic and starterp1 registers. ? enable low-power oscillator in the gpreg4 register in the pcon block. ? select low-power clock for wkt cl ock in the wkt ctrl register. ? start the wkt by writing a time-out value to the wkt count register. interrupt from usart/spi/i2c peripheral ? enable interrupt in nvic and starterp1 registers. ? enable usart/i2c/spi interrupts. ? provide an external clock signal to the peripheral. ? configure the usart in synchronous slave mode and i2c and spi in slave mode. deep power-down wakeup pin pio0_4 enable the wakeup fu nction in the gpreg4 register in the pmu. wkt time-out ? enable the low-power oscillator in the gpreg4 register in the pmu. ? enable the low-power oscillator to keep running in deep power-down mode in the gpreg4 register in the pmu. ? select low-power clock for wkt cl ock in the wkt ctrl register. ? start wkt by writing a time-out value to the wkt count register. table 42. register overview: pmu (base address 0x4002 0000) name access address offset description reset value reference pcon r/w 0x000 power co ntrol register 0x0 ta b l e 4 3 gpreg0 r/w 0x004 general purpose register 0 0x0 ta b l e 4 4 gpreg1 r/w 0x008 general purpose register 1 0x0 ta b l e 4 4 gpreg2 r/w 0x00c general purpose register 2 0x0 ta b l e 4 4 gpreg3 r/w 0x010 general purpose register 3 0x0 ta b l e 4 4 dpdctrl r/w 0x014 deep power-down control register 0x0 ta b l e 4 5
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 44 of 313 nxp semiconductors um10601 chapter 5: lpc800 reduced power modes and power management 5.6.1 power control register the power control register selects whether one of the arm cortex-m0 controlled power-down modes (sleep mode or deep-sleep/power-down mode) or the deep power-down mode is entered and provides the flags for sleep or deep-sleep/power-down modes and deep power-down modes respectively. see for details on how to enter the power-down modes. 5.6.2 general purpose registers 0 to 3 the general purpose registers retain data through the deep power-down mode when power is still applied to the v dd pin but the chip has entered deep power-down mode. only a cold boot - when all po wer has been comple tely removed from the chip - will reset the general purpose registers. table 43. power control register (pcon, address 0x4002 0000) bit description bit symbol value description reset value 2:0 pm power mode 000 0x0 default. the part is in active or sleep mode. 0x1 arm wfi will enter deep-sleep mode. 0x2 arm wfi will enter power-down mode. 0x3 arm wfi will enter deep-power down mode (arm cortex-m0 core powered-down). 3 nodpd a 1 in this bit prevents entry to deep power-down mode when 0x3 is written to the pm field above, the sleepdeep bit is set, and a wfi is executed. this bit is cleared only by power-on reset, so writing a one to this bit locks the part in a mode in which deep power-down mode is blocked. 0 7:4 - - reserved. do not wr ite ones to this bit. 0 8 sleepflag sleep mode flag 0 0 read: no power-down mode entered. lpc11uxx is in active mode. write: no effect. 1 read: sleep/deep-sleep or deep power-down mode entered. write: writing a 1 clears the sleepflag bit to 0. 10:9 - - reserved. do not write ones to this bit. 0 11 dpdflag deep power-down flag 0 0 read: deep power-down mode not entered. write: no effect. 0 1 read: deep power-down mode entered. write: clear the deep power-down flag. 31:12 - - reserved. do not wr ite ones to this bit. 0 table 44. general purpose registers 0 to 3 (g preg[0:3], address 0x4002 0004 (gpreg0) to 0x4002 0010 (gpreg3)) bit description bit symbol description reset value 31:0 gpdata data retained during deep power-down mode. 0x0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 45 of 313 nxp semiconductors um10601 chapter 5: lpc800 reduced power modes and power management 5.6.3 deep power-down control register the deep power-down control re gister controls the low-power oscillator that can be used by the self wake-up timer to wake up from deep power-down mode. in addition, this register configures the functionalit y of the wakeup pin (pin pio0_4). the bits in the register not used for deep power-down control (bits 31:4) can be used for storing additional data which are retained in deep power-down mode in the same way as registers gpreg0 to gpreg3. remark: if there is a possibility that the ex ternal voltage applied on pin v dd drops below 2.2 v during deep power-down, the hysteres is of the wakeup input pin has to be disabled in this register before entering deep power-down mode in order for the chip to wake up. remark: enabling the low-power oscillator in de ep power-down m ode increases the power consumption. only enable this oscillator if you need th e self wake-up timer to wake up the part from deep power-down mode. you may need the self wake-up timer to wake up from deep power-down mode if the wake -up pin is used for other purposes and the wake-up function is not available. table 45. deep power down control register (d pdctrl, address 0x4002 0014) bit description bit symbol value description reset value 0 wakeuphys wakeup pin hysteresis enable 0 0 disabled. hysteresis for wakeup pin disabled. 1 enabled. hysteresis for wakeup pin enabled. 1 wakepad_ disable wakeup pin disable. setting this bit disa bles the wake-up pin, so it can be used for other purposes. remark: never set this bit if you intend to use a pin to wake up the part from deep power-down mode. you can only di sable the wake-up pin if the self wake-up timer is enabled and configured. remark: setting this bit is not necessary if deep power-down mode is not used. 0 0 enabled. the wake-up function is enabled on pin pio0_4. 1 disabled. setting this bit disables the wake-up function on pin pio0_4. 2 lposcen enable the low-power oscillator for use with the 10 khz self wake-up timer clock. you must set this bit if the clksel bit in the self wa ke-up timer ctrl bit is set. do not enable the low-power oscillator if the self wake-up timer is clocked by the divided irc. 0 0 disabled. 1 enabled.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 46 of 313 nxp semiconductors um10601 chapter 5: lpc800 reduced power modes and power management 5.7 functional description 5.7.1 power management the lpc800 support a variety of power control features. in active mode, when the chip is running, power and clocks to selected peripherals can be optimized for power consumption. in addition, there are four special modes of processor power reduction with different peripherals running: sleep mode, deep-sleep mode, power-down mode, and deep power-down mode. remark: the debug mode is not supported in sleep, deep-sleep, power-down, or deep power-down modes. 3 lposcdpden enable the low-power oscillator in deep power-down mode. setting this bit causes the low-power oscillator to remain running during deep power-down mode provided that bit 12 in th is register is set as well. you must set this bit for the self wake- up timer to be able to wake up the part from deep power-down mode. remark: do not set this bit unless you must use the self wake-up timer to wake up from deep power-down mode. 0 0 disabled. 1 enabled. 31:4 - data retained during deep power-down mode. 0x0 table 45. deep power down control register (d pdctrl, address 0x4002 0014) bit description ?continued bit symbol value description reset value table 46. peripheral configuration in reduced power modes peripheral sleep mode deep-sleep mode power-down mode deep power-down mode irc software configurable on off off irc output software configurable off off off flash software configurable on off off bod software configurable software configurable software configurable off pll software configurable off off off sysosc software configurable off off off wdosc/wwdt software configurable software configurable software configurable off digital peripherals software configurable off off off wkt/low-power oscillator software configurable software configurable software configurable software configurable
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 47 of 313 nxp semiconductors um10601 chapter 5: lpc800 reduced power modes and power management 5.7.2 reduced power modes and wwdt lock features the wwdt clock select lock feature influences the power consumption in any of the power modes because locking the wwdt cloc k source forces the selected wwdt clock source to be on independently of the deep-sleep and power-down mode software configuration through the pdsleepc fg register. for details see section 12.5.3 ? using the wwdt lock features ? . if the part uses deep-sleep mode with the ww dt running, the watc hdog oscillator is the preferred clock source as it minimizes power consumption. if the clock source is not locked, the watchdog oscillator must be pow ered by using the pdsleepcfg register. alternatively, the irc may be selected and lo cked in wwdt mod register, which forces the irc on during deep-sleep mode. if the part uses power-down mode with the ww dt running, the watc hdog oscillator must be selected as the clock sour ce. if the clock source is no t locked, the watchdog oscillator must be powered by using the pdsleepcfg re gister. do not lock the clock source with the irc selected. 5.7.3 active mode in active mode, the arm cortex-m0 core and memories are clocked by the system clock, and peripherals are clocked by the system clock or a dedicated peripheral clock. the chip is in active mode after reset and the default power configuration is determined by the reset values of the pdruncfg and sysahbclkctrl regi sters. the power configuration can be changed during run time. 5.7.3.1 power configuration in active mode power consumption in active mode is determi ned by the following configuration choices: ? the sysahbclkctrl register controls which memories and peripherals are running ( table 18 ). ? the power to various analog blocks (pll, oscillators, the adc, the bod circuit, and the flash block) can be controlled at any time individually through the pdruncfg register ( table 37 ? power configuration register (pdruncfg, address 0x4004 8238) bit description ? ). ? the clock source for the system clock can be selected from the irc (default), the system oscillator, or the watchdog oscillator (see figure 3 and related registers). ? the system clock frequency can be selected by the syspllctrl ( table 8 ) and the sysahbclkdiv register ( ta b l e 1 7 ). ? the usart and clkout use individual peripheral clocks with their own clock dividers. the peripheral clo cks can be shut down throu gh the corresponding clock divider registers. 5.7.4 sleep mode in sleep mode, the system clock to the arm cortex-m0+ core is stopped and execution of instructions is suspended until either a reset or an interrupt occurs.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 48 of 313 nxp semiconductors um10601 chapter 5: lpc800 reduced power modes and power management peripheral functions, if selected to be cl ocked in the sysahbclkctrl register, continue operation during sleep mode and may generate interrupts to cause the processor to resume execution. sleep mode eliminates dy namic power used by the processor itself, memory systems and related controllers, and internal buses. the processor state and registers, peripheral register s, and internal sram values are maintained, and the logic levels of the pins remain static. 5.7.4.1 power configuration in sleep mode power consumption in sleep mode is configured by the same settings as in active mode: ? the clock remains running. ? the system clock frequency remains the same as in active mode, but the processor is not clocked. ? analog and digital peripherals are selected as in active mode. 5.7.4.2 programming sleep mode the following steps must be performed to enter sleep mode: 1. the pd bits in the pcon register must be set to the default value 0x0. 2. the sleepdeep bit in the arm cortex-m0+ scr register must be set to zero. 3. use the arm cortex-m0+ wait-f or-interrupt (wfi) instruction. 5.7.4.3 wake-up from sleep mode sleep mode is exited automatically when an in terrupt enabled by the nvic arrives at the processor or a reset occurs. after wake-up due to an interrupt, the microcontroller returns to its original power config uration defined by the cont ents of the pdruncfg and the sysahbclkdiv registers. if a reset occurs, the microcontr oller enters the default configuration in active mode. 5.7.5 deep-sleep mode in deep-sleep mode, the system clock to the processor is disabled as in sleep mode. all analog blocks are powered down , except for the bod circuit and the watchdog oscillator, which must be sele cted or deselected during de ep-sleep mode in the pdsleepcfg register. the main clock, and therefore all per ipheral clocks, are disabled except for the clock to the watchdog timer if the watchdog o scillator is selected. the irc is running, but its output is disabled. the flash is in stand-by mode. deep-sleep mode eliminates all power used by analog peripherals and all dynamic power used by the processor itself, memory systems and related controllers, and internal buses. the processor state and registers, peripheral registers, and internal sram values are maintained, and the logic levels of the pins remain static. 5.7.5.1 power configuration in deep-sleep mode power consumption in deep-sleep mode is determined by the deep-sleep power configuration setting in the pdsleepcfg ( ta b l e 3 5 ) register: ? the watchdog oscillator can be left running in deep-sleep mode if required for the wwdt. ? the bod circuit can be left running in deep-sleep mode if required by the application.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 49 of 313 nxp semiconductors um10601 chapter 5: lpc800 reduced power modes and power management 5.7.5.2 programming deep-sleep mode the following steps must be performed to enter deep-sleep mode: 1. the pd bits in the pcon register must be set to 0x1 ( table 43 ). 2. select the power config uration in deep-sleep mo de in the pdsleepcfg ( ta b l e 3 5 ) register. 3. select the power configuration after wake-up in the pdawakecfg ( ta b l e 3 6 ) register. 4. if any of the available wake-up interrupts are needed for wake-up, enable the interrupts in the interrupt wake-up registers ( ta b l e 3 3 , ta b l e 3 4 ) and in the nvic. 5. write one to the sleepdeep bit in the arm cortex-m 0 scr register. 6. use the arm wfi instruction. 5.7.5.3 wake-up from deep-sleep mode the microcontroller can wake up from deep-sleep mode in the following ways: ? signal on one of the eight pin interrupts selected in ta b l e 3 2 . each pin interrupt must also be enabled in the starterp0 register ( ta b l e 3 3 ) and in the nvic. ? bod signal, if the bod is enabl ed in the pdsl eepcfg register: ? bod interrupt using the deep-sleep interrupt wake-up register 1 ( table 34 ). the bod interrupt must be enabled in the nvic . the bod interrupt mu st be selected in the bodctrl register. ? reset from the bod circuit. in this case , the bod circuit must be enabled in the pdsleepcfg register, and the bod rese t must be enable d in the bodctrl register ( ta b l e 2 8 ). ? wwdt signal, if the watchdog oscillator is enabled in the pdsleepcfg register: ? wwdt interrupt using the interrupt wake-up register 1 ( ta b l e 3 4 ). the wwdt interrupt must be enabled in the nvic. the wwdt interrupt mu st be set in the wwdt mod register. ? reset from the watchdog timer. the wwd t reset must be set in the wwdt mod register. in this case, the watchdog oscilla tor must be running in deep-sleep mode (see pdsleepcfg register), and th e wdt must be enabled in the sysahbclkctrl register. ? via any of the usart blocks. see section 15.3.2 ? configure the usart for wake-up ? . ? via the i2c. see . ? via any of the spi blocks. see . remark: if the watchdog oscillator is runnin g in deep-sleep m ode, its frequency determines the wake-up time. 5.7.6 power-down mode in power-down mode , the system clock to the processor is disabled as in sleep mode. all analog blocks are powered down , except for the bod circuit and the watchdog oscillator, which must be select ed or deselected during powe r-down mode in the pdsleepcfg
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 50 of 313 nxp semiconductors um10601 chapter 5: lpc800 reduced power modes and power management register. the main clock and therefore all pe ripheral clocks are disabled except for the clock to the watchdog timer if the watchdog o scillator is selected. the irc itself and the flash are powered down, decreasing power consumption compared to deep-sleep mode. power-down mode eliminates all power used by analog peripherals and all dynamic power used by the processor itself, memory systems and related controllers, and internal buses. the processor state and registers, peripheral registers, and internal sram values are maintained, and the logic levels of the pins remain static. wake-up times are longer compared to the deep-sleep mode. 5.7.6.1 power configuration in power-down mode power consumption in power-down mode can be configured by the power configuration setting in the pdsleepcfg ( ta b l e 3 5 ) register in the same way as for deep-sleep mode (see section 5.7.5.1 ): ? the watchdog oscillator can be left running in power-down mode if requ ired for the wwdt. ? the bod circuit can be left running in power-down mode if required by the application. 5.7.6.2 programming power-down mode the following steps must be performed to enter power-down mode: 1. the pd bits in the pcon register must be set to 0x2 ( table 43 ). 2. select the power configuration in power-down mode in the pdsleepcfg ( ta b l e 3 5 ) register. 3. select the power configuration after wake-up in the pdawakecfg ( ta b l e 3 6 ) register. 4. if any of the available wake-up interrupts are used for wake-up, enable the interrupts in the interrupt wake-up registers ( ta b l e 3 3 , ta b l e 3 4 ) and in the nvic. 5. write one to the sleepdeep bit in the arm cortex-m 0 scr register. 6. use the arm wfi instruction. 5.7.6.3 wake-up from power-down mode the microcontroller can wake up from power-down mode in the same way as from deep-sleep mode: ? signal on one of the eight pin interrupts selected in ta b l e 3 2 . each pin interrupt must also be enabled in the starterp0 register ( ta b l e 3 3 ) and in the nvic. ? bod signal, if the bod is enabl ed in the pdsl eepcfg register: ? bod interrupt using the interrupt wake-up register 1 ( table 34 ). the bod interrupt must be enabled in the nvic. the bod interrupt must be selected in the bodctrl register. ? reset from the bod circuit. in this case, the bod reset must be enabled in the bodctrl register ( ta b l e 2 8 ). ? wwdt signal, if the watchdog oscillator is enabled in the pdsleepcfg register:
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 51 of 313 nxp semiconductors um10601 chapter 5: lpc800 reduced power modes and power management ? wwdt interrupt using the interrupt wake-up register 1 ( ta b l e 3 4 ). the wwdt interrupt must be enabled in the nvic. the wwdt interrupt mu st be set in the wwdt mod register. ? reset from the watchdog timer. the wwd t reset must be set in the wwdt mod register. ? via any of the usart blocks. see section 15.3.2 ? configure the usart for wake-up ? . ? via the i2c. see . ? via any of the spi blocks. see . 5.7.7 deep power-down mode in deep power-down mode, power and clocks are shut off to the entire chip with the exception of the wakeup pin and the self wake-up timer. during deep power-down mode, the contents of the sram and registers are not retained except for a small amount of data which can be stored in the general purpose registers of the pmu block. all functional pins are tri-st ated in deep power-down mo de except for the wakeup pin. remark: setting bit 3 in the pcon register ( table 43 ) prevents the part from entering deep-power down mode. 5.7.7.1 power configuration in deep power-down mode deep power-down mode has no configuratio n options. all clocks, the core, and all peripherals are powered down . only the wakeup pin and th e self wake-up timer are powered. 5.7.7.2 programming deep power-down mode the following steps must be performed to enter deep power-down mode: 1. pull the wakeup pin externally high. 2. ensure that bit 3 in the pcon register ( ta b l e 4 3 ) is cleared. 3. write 0x3 to the pd bits in the pcon register (see ta b l e 4 3 ). 4. store data to be retained in the general purpose registers ( section 5.6.2 ). 5. write one to the sleepdeep bit in the arm cortex-m 0 scr register. 6. use the arm wfi instruction. 5.7.7.3 wake-up from deep power-down mode pulling the wakeup pin low wakes up the lp c800 from deep power-down, and the part goes through the entire reset process. 1. on the wakeup pin, transition from high to low. ? the pmu will turn on the on-chip voltage r egulator. when the core voltage reaches the power-on-reset (por) trip point, a s ystem reset will be trig gered and the chip re-boots. ? all registers except the gpreg0 to gpre g3 and pcon will be in their reset state.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 52 of 313 nxp semiconductors um10601 chapter 5: lpc800 reduced power modes and power management 2. once the chip has booted, read the deep power-down flag in the pcon register ( ta b l e 4 3 ) to verify that the reset was caused by a wake-up event from deep power-down and was not a cold reset. 3. clear the deep power-down flag in the pcon register ( ta b l e 4 3 ). 4. (optional) read the stored data in the general purpose registers ( section 5.6.2 ). 5. set up the pmu for the next deep power-down cycle. remark: the reset pin has no functionality in deep power-down mode. for using the self wake-up timer for waking up from deep power-down mode, see section 14.5 .
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 53 of 313 6.1 how to read this chapter the iocon block is identical for all lpc800 parts. registers for pins that are not available on a specific package are reserved. 6.2 features the following electrical properties are configurable for each pin: ? pull-up/pull-down resistor ? open-drain mode ? hysteresis ? digital glitch filter with programmable time constant ? analog mode (for a subset of pins, see the lpc81xm data sheet) the true open-drain pins pio0_10 and pio0_11 can be configured for different i2c-bus speeds. 6.3 basic configuration enable the clock to the iocon in the sysahbclkctrl register ( ta b l e 1 8 , bit 18). once the pins are configured, you can disable the iocon clock to conserve power. um10601 chapter 6: lpc800 i/o c onfiguration (iocon) rev. 1.0 ? 7 november 2012 preliminary user manual table 47. pinout summary package pins/configuration registers available tssop16 pio0_ 0 to pio0_13 tssop20 pio0_ 0 to pio0_17 sop20 pio0_0 to pio0_17 dip8 pio0_0 to pio0_5
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 54 of 313 nxp semiconductors um10601 chapter 6: lpc800 i/o configuration (iocon) 6.4 general description 6.4.1 pin configuration 6.4.2 pin function the pin function is determined entirely thro ugh the switch matrix. by default one of the gpio functions is assigned to each pin. the switch matrix can assign all functions from the movable function table to any pin in the iocon block or enable a special function like an analog input on a specific pin. related links: table 94 ? movable functions (assign to pins pio 0_0 to pio_17 through switch matrix) ? 6.4.3 pin mode the mode bit in the iocon register allows enabling or disabling an on-chip pull-up resistor for each pin. by default all pull- up resistors are enabled except for the i 2 c-bus pins pio0_10 and pio0_11, which do not have a programmable pull-up resistor. fig 5. pin configuration  4  4   4   $()#&= 5;"";5 $()#&= 5;""'#:& 4  :+% 5;"";5 :+% 5;""'#:& #5+&')%6&
+&%c"+ #;(5;(
+&%c"+ )+5+%(+)
<#'+ +&%c"+ 5;"";5
+&%c"+ 5;""'#:&
+&%c"+ $+"+!(
'%(% 6&*+)(+) '%(%
#;(5;( '%(%
6&5;( $+"+!(
="6(!7 96"(+) %&%"#=
6&5;( $+"+!(
%&%"#=
6&5;( 56&
!#&96=;)+' %$
'6=6(%"
#;(5;( ')6*+) 56&
!#&96=;)+' %$
'6=6(%"
6&5;( 56&
!#&96=;)+' %$
%&%"#=
6&5;(    
 
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 55 of 313 nxp semiconductors um10601 chapter 6: lpc800 i/o configuration (iocon) the repeater mode enables the pull-up resistor if the pin is high and enables the pull-down resistor if the pin is low. this causes the pin to retain its last known state if it is configured as an input and is not driven exte rnally. repeater mode may typically be used to prevent a pin from floating (and potentially using significant power if it floats to an indeterminate state) if it is temporarily not driven. 6.4.4 open-drain mode an open-drain mode can be enabled for all digital i/o pins. except for pins pio0_10 and pio0_11, this mode is not a true open-drain mode. the input cannot be pulled up above v dd . 6.4.5 analog mode the switch matrix automatically configures the pin in analog mode whenever an analog input or output is selected as the pin?s function. 6.4.6 i 2 c-bus mode the i 2 c-bus pins pio0_10 and pio0_11 can be programmed to support a true open-drain mode independently of whether the i2c function is selected or another digital function. if the i 2 c function is selected, all three i 2 c modes, standard mode, fast-mode, and fast-mode plus, are supported. a digital glitch filter can be configured for all functions. pins pio0_10 and pio0_11 oper ate as high-current sink dr ivers (20 ma) independently of the programmed function. 6.4.7 programmable glitch filter all gpio pins are equipped with a programmable, di gital glitch filter. th e filter rejects input pulses with a selectable duration of shorter than one, two, or three cycles of a filter clock (s_mode = 1, 2, or 3). for each individual pin, the filter clock can be selected from one of seven peripheral clocks pclk0 to 6, which are derived from the main clock using the ioconclkdiv0 to 6 registers. the filter can also be bypassed entirely. any input pulses of duration t pulse of either polarity will be rejected if: t pulse ?? t pclkn ? s_mode input pulses of one filter clock cycle longer may also be rejected: t pulse ??? t pclkn ?? (s_mode + 1) remark: the filtering effect is accomplished by requiring that the input signal be stable for (s_mode +1) successive edges of the filter clock before being passed on to the chip. enabling the filter results in delaying the signal to the internal logic and should be done only if specifically required by an application. for high-speed or time critical functions ensure that the filter is bypassed. if the delay of the input signal must be mini mized, select a faster pclk and a higher sample mode (s_mode) to minimize the effe ct of the potential extra clock cycle. if the sensitivity to noise spikes must be minimized, select a slower pclk and lower sample mode. related registers and links:
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 56 of 313 nxp semiconductors um10601 chapter 6: lpc800 i/o configuration (iocon) table 27 ? iocon glitch filter clock divider registers 6 to 0 (ioconclkdiv[6:0], address 0x4004 8134 (ioconclkdiv6) to 0x004 814c (ioconfiltclkdiv0)) bit description ?
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 57 of 313 nxp semiconductors um10601 chapter 6: lpc800 i/o configuration (iocon) 6.5 register description each port pin pion_m has one iocon register assigned to control the pin?s function and electrical characteristics. 6.5.1 pio0_17 register table 48. register overview: i/o configuration (base address 0x4004 4000) name access address offset description reset value reference pio0_17 r/w 0x000 i/o configuration for pin pio0_17 0x0000 0090 table 49 pio0_13 r/w 0x004 i/o configuration for pin pio0_13 0x0000 0090 table 50 pio0_12 r/w 0x008 i/o configuration for pin pio0_12 0x0000 0090 table 51 pio0_5 r/w 0x00c i/o configuration for pin pio0_5/reset 0x0000 0090 table 52 pio0_4 r/w 0x010 i/o configurat ion for pin pio0_4 0x0000 0090 table 53 pio0_3 r/w 0x014 i/o configuration for pin pio0_3/swclk 0x0000 0090 table 54 pio0_2 r/w 0x018 i/o configuration for pin pio0_2/swdio 0x0000 0090 table 55 pio0_11 r/w 0x01c i/o configurat ion for pin pio0_11. this is the pin configuration for the true open-drain pin. 0x0000 0080 table 56 pio0_10 r/w 0x020 i/o configurat ion for pin pio0_10. this is the pin configuration for the true open-drain pin. 0x0000 0080 table 57 pio0_16 r/w 0x024 i/o configuration for pin pio0_16 0x0000 0090 table 58 pio0_15 r/w 0x028 i/o configuration for pin pio0_15 0x0000 0090 table 59 pio0_1 r/w 0x02c i/o configuration for pin pio0_1/acmp_i1/clkin 0x0000 0090 table 60 - - 0x030 reserved - - pio0_9 r/w 0x034 i/o configuration for pin pio0_9/xtalout 0x0000 0090 table 61 pio0_8 r/w 0x038 i/o configuration for pin pio0_8/xtalin 0x0000 0090 table 62 pio0_7 r/w 0x03c i/o configurat ion for pin pio0_7 0x0000 0090 table 63 pio0_6 r/w 0x040 i/o configuration for pin pio0_6/vddcmp 0x0000 0090 table 64 pio0_0 r/w 0x044 i/o configuration for pin pio0_0/acmp_i0 0x0000 0090 table 65 pio0_14 r/w 0x048 i/o configuration for pin pio0_14 0x0000 0090 table 66 table 49. pio0_17 register (pio0_17, address 0x4004 4000) bit description bit symbol value description reset value 2:0 - reserved. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 58 of 313 nxp semiconductors um10601 chapter 6: lpc800 i/o configuration (iocon) 4:3 mode selects function mode (on- chip pull-up/pull-down resistor control). 0b10 0x0 inactive (no pull-down/pull-up resistor enabled). 0x1 pull-down resistor enabled. 0x2 pull-up resistor enabled. 0x3 repeater mode. 5 hys hysteresis. 0 0 disable. 1 enable. 6 inv invert input 0 0 input not inverted (high on pin reads as 1; low on pin reads as 0). 1 input inverted (high on pin reads as 0, low on pin reads as 1). 9:7 - - reserved. 0b001 10 od open-drain mode. 0 0 disable. 1 open-drain mode enabled. remark: this is not a true open-drain mode. 12:11 s_mode digital filter sample mode. 0 0x0 bypass input filter. 0x1 1 clock cycle. input pulses sh orter than one filter clock are rejected. 0x2 2 clock cycles. input pulses s horter than two filter clocks are rejected. 0x3 3 clock cycles. input pulses shor ter than three filter clocks are rejected. 15:13 clk_div select peripheral clock divider for input filter sampling clock. value 0x7 is reserved. 0 0x0 ioconclkdiv0. 0x1 ioconclkdiv1. 0x2 ioconclkdiv2. 0x3 ioconclkdiv3. 0x4 ioconclkdiv4. 0x5 ioconclkdiv5. 0x6 ioconclkdiv6. 31:16 - - reserved. 0 table 49. pio0_17 register (pio0_17, address 0x4004 4000) bit description bit symbol value description reset value
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 59 of 313 nxp semiconductors um10601 chapter 6: lpc800 i/o configuration (iocon) 6.5.2 pio0_13 register table 50. pio0_13 register (pio0_13, address 0x4004 4004) bit description bit symbol value description reset value 2:0 - reserved. 0 4:3 mode selects function mode (on- chip pull-up/pull-down resistor control). 0b10 0x0 inactive (no pull-down/pull-up resistor enabled). 0x1 pull-down resistor enabled. 0x2 pull-up resistor enabled. 0x3 repeater mode. 5 hys hysteresis. 0 0 disable. 1 enable. 6 inv invert input 0 0 input not inverted (high on pin reads as 1; low on pin reads as 0). 1 input inverted (high on pin reads as 0, low on pin reads as 1). 9:7 - - reserved. 0b001 10 od open-drain mode. 0 0 disable. 1 open-drain mode enabled. remark: this is not a true open-drain mode. 12:11 s_mode digital filter sample mode. 0 0x0 bypass input filter. 0x1 1 clock cycle. input pulses sh orter than one filter clock are rejected. 0x2 2 clock cycles. input pulses s horter than two filter clocks are rejected. 0x3 3 clock cycles. input pulses shor ter than three filter clocks are rejected. 15:13 clk_div select peripheral clock divider for input filter sampling clock. value 0x7 is reserved. 0 0x0 ioconclkdiv0. 0x1 ioconclkdiv1. 0x2 ioconclkdiv2. 0x3 ioconclkdiv3. 0x4 ioconclkdiv4. 0x5 ioconclkdiv5. 0x6 ioconclkdiv6. 31:16 - - reserved. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 60 of 313 nxp semiconductors um10601 chapter 6: lpc800 i/o configuration (iocon) 6.5.3 pio0_12 register table 51. pio0_12 register (pio0_12, address 0x4004 4008) bit description bit symbol value description reset value 2:0 - reserved. 0 4:3 mode selects function mode (on- chip pull-up/pull-down resistor control). 0b10 0x0 inactive (no pull-down/pull-up resistor enabled). 0x1 pull-down resistor enabled. 0x2 pull-up resistor enabled. 0x3 repeater mode. 5 hys hysteresis. 0 0 disable. 1 enable. 6 inv invert input 0 0 input not inverted (high on pin reads as 1; low on pin reads as 0). 1 input inverted (high on pin reads as 0, low on pin reads as 1). 9:7 - - reserved. 0b001 10 od open-drain mode. 0 0 disable. 1 open-drain mode enabled. remark: this is not a true open-drain mode. 12:11 s_mode digital filter sample mode. 0 0x0 bypass input filter. 0x1 1 clock cycle. input pulses sh orter than one filter clock are rejected. 0x2 2 clock cycles. input pulses s horter than two filter clocks are rejected. 0x3 3 clock cycles. input pulses shor ter than three filter clocks are rejected. 15:13 clk_div select peripheral clock divider for input filter sampling clock. value 0x7 is reserved. 0 0x0 ioconclkdiv0. 0x1 ioconclkdiv1. 0x2 ioconclkdiv2. 0x3 ioconclkdiv3. 0x4 ioconclkdiv4. 0x5 ioconclkdiv5. 0x6 ioconclkdiv6. 31:16 - - reserved. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 61 of 313 nxp semiconductors um10601 chapter 6: lpc800 i/o configuration (iocon) 6.5.4 pio0_5 register table 52. pio0_5 register (pio0_5, ad dress 0x4004 400c) bit description bit symbol value description reset value 2:0 - reserved. 0 4:3 mode selects function mode (on- chip pull-up/pull-down resistor control). 0b10 0x0 inactive (no pull-down/pull-up resistor enabled). 0x1 pull-down resistor enabled. 0x2 pull-up resistor enabled. 0x3 repeater mode. 5 hys hysteresis. 0 0 disable. 1 enable. 6 inv invert input 0 0 input not inverted (high on pin reads as 1; low on pin reads as 0). 1 input inverted (high on pin reads as 0, low on pin reads as 1). 9:7 - - reserved. 0b001 10 od open-drain mode. 0 0 disable. 1 open-drain mode enabled. remark: this is not a true open-drain mode. 12:11 s_mode digital filter sample mode. 0 0x0 bypass input filter. 0x1 1 clock cycle. input pulses sh orter than one filter clock are rejected. 0x2 2 clock cycles. input pulses s horter than two filter clocks are rejected. 0x3 3 clock cycles. input pulses shor ter than three filter clocks are rejected. 15:13 clk_div select peripheral clock divider for input filter sampling clock. value 0x7 is reserved. 0 0x0 ioconclkdiv0. 0x1 ioconclkdiv1. 0x2 ioconclkdiv2. 0x3 ioconclkdiv3. 0x4 ioconclkdiv4. 0x5 ioconclkdiv5. 0x6 ioconclkdiv6. 31:16 - - reserved. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 62 of 313 nxp semiconductors um10601 chapter 6: lpc800 i/o configuration (iocon) 6.5.5 pio0_4 register table 53. pio0_ 4 register (pio0_ 4 , address 0x4004 4010) bit description bit symbol value description reset value 2:0 - reserved. 0 4:3 mode selects function mode (on- chip pull-up/pull-down resistor control). 0b10 0x0 inactive (no pull-down/pull-up resistor enabled). 0x1 pull-down resistor enabled. 0x2 pull-up resistor enabled. 0x3 repeater mode. 5 hys hysteresis. 0 0 disable. 1 enable. 6 inv invert input 0 0 input not inverted (high on pin reads as 1; low on pin reads as 0). 1 input inverted (high on pin reads as 0, low on pin reads as 1). 9:7 - - reserved. 0b001 10 od open-drain mode. 0 0 disable. 1 open-drain mode enabled. remark: this is not a true open-drain mode. 12:11 s_mode digital filter sample mode. 0 0x0 bypass input filter. 0x1 1 clock cycle. input pulses shorter than one filter clock are rejected. 0x2 2 clock cycles. input pulses shor ter than two filter clocks are rejected. 0x3 3 clock cycles. input pulses shorter than three filter clocks are rejected. 15:13 clk_div select peripheral clock divider for input filter sampling clock. value 0x7 is reserved. 0 0x0 ioconclkdiv0. 0x1 ioconclkdiv1. 0x2 ioconclkdiv2. 0x3 ioconclkdiv3. 0x4 ioconclkdiv4. 0x5 ioconclkdiv5. 0x6 ioconclkdiv6. 31:16 - - reserved. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 63 of 313 nxp semiconductors um10601 chapter 6: lpc800 i/o configuration (iocon) 6.5.6 pio0_3 register table 54. pio0_3 register (pio0_3, ad dress 0x4004 4014) bit description bit symbol value description reset value 2:0 - reserved. 0 4:3 mode selects function mode (on- chip pull-up/pull-down resistor control). 0b10 0x0 inactive (no pull-down/pull-up resistor enabled). 0x1 pull-down resistor enabled. 0x2 pull-up resistor enabled. 0x3 repeater mode. 5 hys hysteresis. 0 0 disable. 1 enable. 6 inv invert input. 0 0 input not inverted (high on pin reads as 1; low on pin reads as 0). 1 input inverted (high on pin reads as 0, low on pin reads as 1). 9:7 - - reserved. 0b001 10 od open-drain mode. 0 0 disable. 1 open-drain mode enabled. remark: this is not a true open-drain mode. 12:11 s_mode digital filter sample mode. 0 0x0 bypass input filter. 0x1 1 clock cycle. input pulses s horter than one filter clock are rejected. 0x2 2 clock cycles. input pulses sh orter than two filter clocks are rejected. 0x3 3 clock cycles. input pulses sh orter than three filter clocks are rejected. 15:13 clk_div select peripheral clock divider for input filter sampling clock. value 0x7 is reserved. 0 0x0 ioconclkdiv0. 0x1 ioconclkdiv1. 0x2 ioconclkdiv2. 0x3 ioconclkdiv3. 0x4 ioconclkdiv4. 0x5 ioconclkdiv5. 0x6 ioconclkdiv6. 31:16 - - reserved. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 64 of 313 nxp semiconductors um10601 chapter 6: lpc800 i/o configuration (iocon) 6.5.7 pio0_2 register table 55. pio0_2 register (pio0_2, ad dress 0x4004 4018) bit description bit symbol value description reset value 2:0 - reserved. 0 4:3 mode selects function mode (on- chip pull-up/pull-down resistor control). 0b10 0x0 inactive (no pull-down/pull-up resistor enabled). 0x1 pull-down resistor enabled. 0x2 pull-up resistor enabled. 0x3 repeater mode. 5 hys hysteresis. 0 0 disable. 1 enable. 6 inv invert input. 0 0 input not inverted (high on pin reads as 1; low on pin reads as 0). 1 input inverted (high on pin reads as 0, low on pin reads as 1). 9:7 - - reserved. 0b001 10 od open-drain mode. 0 0 disable. 1 open-drain mode enabled. remark: this is not a true open-drain mode. 12:11 s_mode digital filter sample mode. 0 0x0 bypass input filter. 0x1 1 clock cycle. input pulses sh orter than one filter clock are rejected. 0x2 2 clock cycles. input pulses s horter than two filter clocks are rejected. 0x3 3 clock cycles. input pulses shor ter than three filter clocks are rejected. 15:13 clk_div select peripheral clock divider for input filter sampling clock. value 0x7 is reserved. 0 0x0 ioconclkdiv0. 0x1 ioconclkdiv1. 0x2 ioconclkdiv2. 0x3 ioconclkdiv3. 0x4 ioconclkdiv4. 0x5 ioconclkdiv5. 0x6 ioconclkdiv6. 31:16 - - reserved. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 65 of 313 nxp semiconductors um10601 chapter 6: lpc800 i/o configuration (iocon) 6.5.8 pio0_11 register table 56. pio0_11 register (pio0_11, address 0x4004 401c) bit description bit symbol value description reset value 5:0 - reserved. 0 6 inv invert input 0 0 input not inverted (high on pin reads as 1; low on pin reads as 0). 1 input inverted (high on pin reads as 0, low on pin reads as 1). 7- reserved. 1 9:8 i2cmode selects i2c mode. select standard mode (i2cmode = 00, default) or standard i/o functionality (i2cmode = 01) if the pin function is gpio (func = 000). 00 0x0 standard mode/ fast-mode i2c. 0x1 standard i/o functionality 0x2 fast-mode plus i2c 0x3 reserved. 10 - - reserved. - 12:11 s_mode digital filter sample mode. 0 0x0 bypass input filter. 0x1 1 clock cycle. input pulses shorter than one filter clock are rejected. 0x2 2 clock cycles. input pulses shorter than tw o filter clocks are rejected. 0x3 3 clock cycles. input pulses sh orter than three filter clocks are rejected. 15:13 clk_div select peripheral clock divider for input filter sampling clock. value 0x7 is reserved. 0 0x0 ioconclkdiv0. 0x1 ioconclkdiv1. 0x2 ioconclkdiv2. 0x3 ioconclkdiv3. 0x4 ioconclkdiv4. 0x5 ioconclkdiv5. 0x6 ioconclkdiv6. 31:16 - - reserved. -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 66 of 313 nxp semiconductors um10601 chapter 6: lpc800 i/o configuration (iocon) 6.5.9 pio0_10 register table 57. pio0_10 register (pio0_10, address 0x4004 4020) bit description bit symbol value description reset value 5:0 - reserved. 0 6 inv invert input 0 0 input not inverted (high on pin reads as 1; low on pin reads as 0). 1 input inverted (high on pin reads as 0, low on pin reads as 1). 7- reserved. 1 9:8 i2cmode selects i2c mode. select standard mode (i2cmode = 00, default) or standard i/o functionality (i2cmode = 01) if the pin function is gpio (func = 000). 00 0x0 standard mode/ fast-mode i2c. 0x1 standard i/o functionality 0x2 fast-mode plus i2c 0x3 reserved. 10 - - reserved. - 12:11 s_mode digital filter sample mode. 0 0x0 bypass input filter. 0x1 1 clock cycle. input pulses shorter than one filter clock are rejected. 0x2 2 clock cycles. input pulses shor ter than two filter clocks are rejected. 0x3 3 clock cycles. input pulses sh orter than three filter clocks are rejected. 15:13 clk_div select peripheral clock divider for input filter sampling clock. value 0x7 is reserved. 0 0x0 ioconclkdiv0. 0x1 ioconclkdiv1. 0x2 ioconclkdiv2. 0x3 ioconclkdiv3. 0x4 ioconclkdiv4. 0x5 ioconclkdiv5. 0x6 ioconclkdiv6. 31:16 - - reserved. -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 67 of 313 nxp semiconductors um10601 chapter 6: lpc800 i/o configuration (iocon) 6.5.10 pio0_16 register table 58. pio0_16 register (pio0_16, address 0x4004 4024) bit description bit symbol value description reset value 2:0 - reserved. 0 4:3 mode selects function mode (on- chip pull-up/pull-down resistor control). 0b10 0x0 inactive (no pull-down/pull-up resistor enabled). 0x1 pull-down resistor enabled. 0x2 pull-up resistor enabled. 0x3 repeater mode. 5 hys hysteresis. 0 0 disable. 1 enable. 6 inv invert input 0 0 input not inverted (high on pin reads as 1; low on pin reads as 0). 1 input inverted (high on pin reads as 0, low on pin reads as 1). 9:7 - - reserved. 0b001 10 od open-drain mode. 0 0 disable. 1 open-drain mode enabled. remark: this is not a true open-drain mode. 12:11 s_mode digital filter sample mode. 0 0x0 bypass input filter. 0x1 1 clock cycle. input pulses sh orter than one filter clock are rejected. 0x2 2 clock cycles. input pulses s horter than two filter clocks are rejected. 0x3 3 clock cycles. input pulses shor ter than three filter clocks are rejected. 15:13 clk_div select peripheral clock divider for input filter sampling clock. value 0x7 is reserved. 0 0x0 ioconclkdiv0. 0x1 ioconclkdiv1. 0x2 ioconclkdiv2. 0x3 ioconclkdiv3. 0x4 ioconclkdiv4. 0x5 ioconclkdiv5. 0x6 ioconclkdiv6. 31:16 - - reserved. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 68 of 313 nxp semiconductors um10601 chapter 6: lpc800 i/o configuration (iocon) 6.5.11 pio0_15 register table 59. pio0_15 register (pio0_15, address 0x4004 4028) bit description bit symbol value description reset value 2:0 - reserved. 0 4:3 mode selects function mode (on- chip pull-up/pull-down resistor control). 0b10 0x0 inactive (no pull-down/pull-up resistor enabled). 0x1 pull-down resistor enabled. 0x2 pull-up resistor enabled. 0x3 repeater mode. 5 hys hysteresis. 0 0 disable. 1 enable. 6 inv invert input 0 0 input not inverted (high on pin reads as 1; low on pin reads as 0). 1 input inverted (high on pin reads as 0, low on pin reads as 1). 9:7 - - reserved. 0b001 10 od open-drain mode. 0 0 disable. 1 open-drain mode enabled. remark: this is not a true open-drain mode. 12:11 s_mode digital filter sample mode. 0 0x0 bypass input filter. 0x1 1 clock cycle. input pulses s horter than one filter clock are rejected. 0x2 2 clock cycles. input pulses sh orter than two filter clocks are rejected. 0x3 3 clock cycles. input pulses shor ter than three filter clocks are rejected. 15:13 clk_div select peripheral clock divider for input filter sampling clock. value 0x7 is reserved. 0 0x0 ioconclkdiv0. 0x1 ioconclkdiv1. 0x2 ioconclkdiv2. 0x3 ioconclkdiv3. 0x4 ioconclkdiv4. 0x5 ioconclkdiv5. 0x6 ioconclkdiv6. 31:16 - - reserved. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 69 of 313 nxp semiconductors um10601 chapter 6: lpc800 i/o configuration (iocon) 6.5.12 pio0_1 register table 60. pio0_1 register (pio0_1, ad dress 0x4004 402c) bit description bit symbol value description reset value 2:0 - reserved. 0 4:3 mode selects function mode (on- chip pull-up/pull-down resistor control). 0b10 0x0 inactive (no pull-down/pull-up resistor enabled). 0x1 pull-down resistor enabled. 0x2 pull-up resistor enabled. 0x3 repeater mode. 5 hys hysteresis. 0 0 disable. 1 enable. 6 inv invert input 0 0 input not inverted (high on pin reads as 1; low on pin reads as 0). 1 input inverted (high on pin reads as 0, low on pin reads as 1). 9:7 - - reserved. 0b001 10 od open-drain mode. 0 0 disable. 1 open-drain mode enabled. remark: this is not a true open-drain mode. 12:11 s_mode digital filter sample mode. 0 0x0 bypass input filter. 0x1 1 clock cycle. input pulses sh orter than one filter clock are rejected. 0x2 2 clock cycles. input pulses s horter than two filter clocks are rejected. 0x3 3 clock cycles. input pulses shor ter than three filter clocks are rejected. 15:13 clk_div select peripheral clock divider for input filter sampling clock. value 0x7 is reserved. 0 0x0 ioconclkdiv0. 0x1 ioconclkdiv1. 0x2 ioconclkdiv2. 0x3 ioconclkdiv3. 0x4 ioconclkdiv4. 0x5 ioconclkdiv5. 0x6 ioconclkdiv6. 31:16 - - reserved. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 70 of 313 nxp semiconductors um10601 chapter 6: lpc800 i/o configuration (iocon) 6.5.13 pio0_9 register table 61. pio0_9 register (pio0_9, ad dress 0x4004 4034) bit description bit symbol value description reset value 2:0 - reserved. 0 4:3 mode selects function mode (on- chip pull-up/pull-down resistor control). 10 0x0 inactive (no pull-down/pull-up resistor enabled). 0x1 pull-down resistor enabled. 0x2 pull-up resistor enabled. 0x3 repeater mode. 5 hys hysteresis. 0 0 disable. 1 enable. 6 inv invert input 0 0 input not inverted (high on pin reads as 1; low on pin reads as 0). 1 input inverted (high on pin reads as 0, low on pin reads as 1). 9:7 - - reserved. 001 10 od open-drain mode. 0 0 disable. 1 open-drain mode enabled. remark: this is not a true open-drain mode. 12:11 s_mode digital filter sample mode. 0 0x0 bypass input filter. 0x1 1 clock cycle. input pulses sh orter than one filter clock are rejected. 0x2 2 clock cycles. input pulses s horter than two filter clocks are rejected. 0x3 3 clock cycles. input pulses shor ter than three filter clocks are rejected. 15:13 clk_div select peripheral clock divider for input filter sampling clock. value 0x7 is reserved. 0 0x0 ioconclkdiv0. 0x1 ioconclkdiv1. 0x2 ioconclkdiv2. 0x3 ioconclkdiv3. 0x4 ioconclkdiv4. 0x5 ioconclkdiv5. 0x6 ioconclkdiv6. 31:16 - - reserved. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 71 of 313 nxp semiconductors um10601 chapter 6: lpc800 i/o configuration (iocon) 6.5.14 pio0_8 register table 62. pio0_8 register (pio0_8, ad dress 0x4004 4038) bit description bit symbol value description reset value 2:0 - reserved. 0 4:3 mode selects function mode (on- chip pull-up/pull-down resistor control). 0b10 0x0 inactive (no pull-down/pull-up resistor enabled). 0x1 pull-down resistor enabled. 0x2 pull-up resistor enabled. 0x3 repeater mode. 5 hys hysteresis. 0 0 disable. 1 enable. 6 inv invert input 0 0 input not inverted (high on pin reads as 1; low on pin reads as 0). 1 input inverted (high on pin reads as 0, low on pin reads as 1). 9:7 - - reserved. 0b001 10 od open-drain mode. 0 0 disable. 1 open-drain mode enabled. remark: this is not a true open-drain mode. 12:11 s_mode digital filter sample mode. 0 0x0 bypass input filter. 0x1 1 clock cycle. input pulses sh orter than one filter clock are rejected. 0x2 2 clock cycles. input pulses s horter than two filter clocks are rejected. 0x3 3 clock cycles. input pulses shor ter than three filter clocks are rejected. 15:13 clk_div select peripheral clock divider for input filter sampling clock. value 0x7 is reserved. 0 0x0 ioconclkdiv0. 0x1 ioconclkdiv1. 0x2 ioconclkdiv2. 0x3 ioconclkdiv3. 0x4 ioconclkdiv4. 0x5 ioconclkdiv5. 0x6 ioconclkdiv6. 31:16 - - reserved. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 72 of 313 nxp semiconductors um10601 chapter 6: lpc800 i/o configuration (iocon) 6.5.15 pio0_7 register table 63. pio0_7 register (pio0_7, ad dress 0x4004 403c) bit description bit symbol value description reset value 2:0 - reserved. 0 4:3 mode selects function mode (on- chip pull-up/pull-down resistor control). 0b10 0x0 inactive (no pull-down/pull-up resistor enabled). 0x1 pull-down resistor enabled. 0x2 pull-up resistor enabled. 0x3 repeater mode. 5 hys hysteresis. 0 0 disable. 1 enable. 6 inv invert input 0 0 input not inverted (high on pin reads as 1; low on pin reads as 0). 1 input inverted (high on pin reads as 0, low on pin reads as 1). 9:7 - - reserved. 0b001 10 od open-drain mode. 0 0 disable. 1 open-drain mode enabled. remark: this is not a true open-drain mode. 12:11 s_mode digital filter sample mode. 0 0x0 bypass input filter. 0x1 1 clock cycle. input pulses sh orter than one filter clock are rejected. 0x2 2 clock cycles. input pulses s horter than two filter clocks are rejected. 0x3 3 clock cycles. input pulses shor ter than three filter clocks are rejected. 15:13 clk_div select peripheral clock divider for input filter sampling clock. value 0x7 is reserved. 0 0x0 ioconclkdiv0. 0x1 ioconclkdiv1. 0x2 ioconclkdiv2. 0x3 ioconclkdiv3. 0x4 ioconclkdiv4. 0x5 ioconclkdiv5. 0x6 ioconclkdiv6. 31:16 - - reserved. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 73 of 313 nxp semiconductors um10601 chapter 6: lpc800 i/o configuration (iocon) 6.5.16 pio0_6 register table 64. pio0_6 register (pio0_6, ad dress 0x4004 4040) bit description bit symbol value description reset value 2:0 - reserved. 0 4:3 mode selects function mode (on- chip pull-up/pull-down resistor control). 10 0x0 inactive (no pull-down/pull-up resistor enabled). 0x1 pull-down resistor enabled. 0x2 pull-up resistor enabled. 0x3 repeater mode. 5 hys hysteresis. 0 0 disable. 1 enable. 6 inv invert input 0 0 input not inverted (high on pin reads as 1; low on pin reads as 0). 1 input inverted (high on pin reads as 0, low on pin reads as 1). 9:7 - - reserved. 001 10 od open-drain mode. 0 0 disable. 1 open-drain mode enabled. remark: this is not a true open-drain mode. 12:11 s_mode digital filter sample mode. 0 0x0 bypass input filter. 0x1 1 clock cycle. input pulses sh orter than one filter clock are rejected. 0x2 2 clock cycles. input pulses s horter than two filter clocks are rejected. 0x3 3 clock cycles. input pulses shor ter than three filter clocks are rejected. 15:13 clk_div select peripheral clock divider for input filter sampling clock. value 0x7 is reserved. 0 0x0 ioconclkdiv0. 0x1 ioconclkdiv1. 0x2 ioconclkdiv2. 0x3 ioconclkdiv3. 0x4 ioconclkdiv4. 0x5 ioconclkdiv5. 0x6 ioconclkdiv6. 31:16 - - reserved. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 74 of 313 nxp semiconductors um10601 chapter 6: lpc800 i/o configuration (iocon) 6.5.17 pio0_0 register table 65. pio0_0 register (pio0_0, ad dress 0x4004 4044) bit description bit symbol value description reset value 2:0 - reserved. 0 4:3 mode selects function mode (on- chip pull-up/pull-down resistor control). 0b10 0x0 inactive (no pull-down/pull-up resistor enabled). 0x1 pull-down resistor enabled. 0x2 pull-up resistor enabled. 0x3 repeater mode. 5 hys hysteresis. 0 0 disable. 1 enable. 6 inv invert input 0 0 input not inverted (high on pin reads as 1; low on pin reads as 0). 1 input inverted (high on pin reads as 0, low on pin reads as 1). 9:7 - - reserved. 0b001 10 od open-drain mode. 0 0 disable. 1 open-drain mode enabled. remark: this is not a true open-drain mode. 12:11 s_mode digital filter sample mode. 0 0x0 bypass input filter. 0x1 1 clock cycle. input pulses sh orter than one filter clock are rejected. 0x2 2 clock cycles. input pulses s horter than two filter clocks are rejected. 0x3 3 clock cycles. input pulses shor ter than three filter clocks are rejected. 15:13 clk_div select peripheral clock divider for input filter sampling clock. value 0x7 is reserved. 0 0x0 ioconclkdiv0. 0x1 ioconclkdiv1. 0x2 ioconclkdiv2. 0x3 ioconclkdiv3. 0x4 ioconclkdiv4. 0x5 ioconclkdiv5. 0x6 ioconclkdiv6. 31:16 - - reserved. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 75 of 313 nxp semiconductors um10601 chapter 6: lpc800 i/o configuration (iocon) 6.5.18 pio0_14 register table 66. pio0_14 register (pio0_14, address 0x4004 4048) bit description bit symbol value description reset value 2:0 - reserved. 0 4:3 mode selects function mode (on- chip pull-up/pull-down resistor control). 0b10 0x0 inactive (no pull-down/pull-up resistor enabled). 0x1 pull-down resistor enabled. 0x2 pull-up resistor enabled. 0x3 repeater mode. 5 hys hysteresis. 0 0 disable. 1 enable. 6 inv invert input 0 0 input not inverted (high on pin reads as 1; low on pin reads as 0). 1 input inverted (high on pin reads as 0, low on pin reads as 1). 9:7 - - reserved. 0b001 10 od open-drain mode. 0 0 disable. 1 open-drain mode enabled. remark: this is not a true open-drain mode. 12:11 s_mode digital filter sample mode. 0 0x0 bypass input filter. 0x1 1 clock cycle. input pulses sh orter than one filter clock are rejected. 0x2 2 clock cycles. input pulses s horter than two filter clocks are rejected. 0x3 3 clock cycles. input pulses shor ter than three filter clocks are rejected. 15:13 clk_div select peripheral clock divider for input filter sampling clock. value 0x7 is reserved. 0 0x0 ioconclkdiv0. 0x1 ioconclkdiv1. 0x2 ioconclkdiv2. 0x3 ioconclkdiv3. 0x4 ioconclkdiv4. 0x5 ioconclkdiv5. 0x6 ioconclkdiv6. 31:16 - - reserved. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 76 of 313 7.1 how to read this chapter all gpio registers refer to 32 pins per port. depending on the package type, not all pins are available, and the corresponding bits in the gpio registers are reserved (see ta b l e 6 7 ). 7.2 features ? gpio port registers are located on the ar m cortex m0+ i/o port for fast access. ? the arm cortex m0+ i/o port supports single-cycle access. ? gpio ports ? gpio pins can be configured as input or output by software. ? all gpio pins default to inputs with interrupt disabled at reset. ? pin interrupt registers allow pins to be sensed and set individually. 7.3 basic configuration for the gpio port registers, enable the cl ock to the gpio port registers in the sysahbclkctrl register ( table 18 , bit 6). 7.4 pin description all gpio functions are fixed-pin functions. th e switch matrix assigns every gpio port pin to one and only one pin on the lpc800 packa ge. by default, the switch matrix connects all package pins except supply and groun d pins to their gpio port pins. the pin description table (see the lpc81xm data sheet) shows how the gpio port pins are assigned to lpc800 package pins. 7.5 general description the gpio port registers can be used to configure each gpio pin as input or output and read the state of each pin if the pin is configured as input or set the state of each pin if the pin is configured as output. um10601 chapter 7: lpc800 gpio port rev. 1.0 ? 7 november 2012 preliminary user manual table 67. gpio pins available package gpio port 0 tssop16 pio0_ 0 to pio0_13 tssop20 pio0_ 0 to pio0_17 sop20 pio0_0 to pio0_17 dip8 pio0_0 to pio0_5
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 77 of 313 nxp semiconductors um10601 chapter 7: lpc800 gpio port 7.6 register description the gpio port registers and the gpio pin inte rrupt registers are located on the arm m0+ i/o port. the i/o port supports single-cycle access. remark: in all gpio registers, bits that are not shown are reserved. gpio port addresses can be read and wri tten as bytes, halfwords, or words. ?ext? indicates that the data read after reset depends on the state of the pin, which in turn may depend on an external source. 7.6.1 gpio port byte pin registers each gpio pin has a byte register in this address range. software typically reads and writes bytes to access individual pins, but can read or write halfwords to sense or set the state of two pins, and read or write words to sense or set the state of four pins. 7.6.2 gpio port wo rd pin registers each gpio pin has a word register in this address range. any byte, halfword, or word read in this range will be all zeros if the pin is low or all ones if the pin is high, regardless of direction, masking, or alternate function, except that pins configured as analog i/o always read as zeros. any write will clear the pin?s output bit if the value written is all zeros, else it will set the pin?s output bit. table 68. register overview: gpio port (base address 0xa000 0000) name access address offset description reset value width reference b0 to b17 r/w 0x0000 to 0x0012 byte pin registers port 0; pins pio0_0 to pio0_17 ext byte (8 bit) ta b l e 6 9 w0 to w17 r/w 0x1000 to 0x1048 word pin registers port 0 ext word (32 bit) ta b l e 7 0 dir0 r/w 0x2000 direction registers port 0 0 word (32 bit) ta b l e 7 1 mask0 r/w 0x2080 mask register port 0 0 word (32 bit) ta b l e 7 2 pin0 r/w 0x2100 port pin regist er port 0 ext word (32 bit) ta b l e 7 3 mpin0 r/w 0x2180 masked port register port 0 ext word (32 bit) ta b l e 7 4 set0 r/w 0x2200 write: set register for port 0 read: output bits for port 0 0 word (32 bit) ta b l e 7 5 clr0 wo 0x2280 clear port 0 na word (32 bit) ta b l e 7 6 not0 wo 0x2300 toggle port 0 na word (32 bit) ta b l e 7 7 table 69. gpio port 0 byte pin registers (b[0:17], addresses 0xa000 0000 (b0) to 0xa000 0012 (b17)) bit description bit symbol description reset value access 0 pbyte read: state of the pin pio0 _n, regardless of direction, masking, or alternate function, except that pins configured as analog i/o always read as 0. write: loads the pin?s output bit. ext r/w 7:1 reserved (0 on read, ignored on write) 0 -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 78 of 313 nxp semiconductors um10601 chapter 7: lpc800 gpio port 7.6.3 gpio port direction registers each gpio port has one direction register fo r configuring the port pins as inputs or outputs. 7.6.4 gpio port mask registers these registers affect writing and reading the mport registers. zeroes in these registers enable reading and writing; ones disable wr iting and result in zeros in corresponding positions when reading. 7.6.5 gpio port pin registers reading these registers returns the current stat e of the pins read, regardless of direction, masking, or alternate functions, except that pins configured as analog i/o always read as 0s. writing these registers loads the output bits of the pins written to, regardless of the mask register. table 70. gpio port 0 word pin registers (w[0:17], addresses 0xa000 1000 (w0) to 0x5000 1048 (w17)) bit description bit symbol description reset value access 31:0 pword read 0: pin is low. write 0: clear output bit. read 0xffff ffff: pin is high. write any value 0x0000 0001 to 0xffff ffff: set output bit. remark: only 0 or 0xffff ffff can be read. writing any value other than 0 will set the output bit. ext r/w table 71. gpio direction port 0 register (d ir0, address 0xa000 2000) bit description bit symbol description reset value access 17:0 dirp0 selects pin direction for pin pio0_n (bit 0 = pio0_0, bit 1 = pio0_1, ..., bit 17 = pio0_17). 0 = input. 1 = output. 0r/w 31:18 - reserved. 0 - table 72. gpio mask port 0 register (mask0, address 0xa000 2080) bit description bit symbol description reset value access 17:0 maskp0 controls which bits corresponding to pio0_n are active in the p0mport register (bit 0 = pio0_0, bit 1 = pio0_1, ..., bit 17 = pio0_17). 0 = read mport: pin state; write mport: load output bit. 1 = read mport: 0; write mport: output bit not affected. 0r/w 31:18 - reserved. 0 -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 79 of 313 nxp semiconductors um10601 chapter 7: lpc800 gpio port 7.6.6 gpio masked port pin registers these registers are similar to the pin registers, except that the value read is masked by anding with the inverted contents of the corre sponding mask register, and writing to one of these registers only affects output regist er bits that are enabled by zeros in the corresponding mask register 7.6.7 gpio port set registers output bits can be set by wr iting ones to these registers, regardless of mask registers. reading from these register returns the port?s output bits, regardless of pin directions. 7.6.8 gpio port clear registers output bits can be cleared by writing ones to these write-only registers, regardless of mask registers. table 73. gpio port 0 pin register (pin0, address 0xa000 2100) bit description bit symbol description reset value access 17:0 port0 reads pin states or loads output bits (bit 0 = pio0_0, bit 1 = pio0_1, ..., bit 17 = pio0_17). 0 = read: pin is low; write: clear output bit. 1 = read: pin is high; write: set output bit. ext r/w 31:18 - reserved. 0 - table 74. gpio masked port 0 pin register (mpin0, address 0xa000 2180) bit description bit symbol description reset value access 17:0 mportp0 masked port register (bit 0 = pio0_0, bit 1 = pio0_1, ..., bit 17 = pio0_17). 0 = read: pin is low and/or the corresponding bit in the mask register is 1; write: clear output bit if the corresponding bit in the mask register is 0. 1 = read: pin is high and the corresponding bit in the mask register is 0; writ e: set output bit if the corresponding bit in the mask register is 0. ext r/w 31:18 - reserved. 0 - table 75. gpio set port 0 register (set0, address 0xa000 2200) bit description bit symbol description reset value access 17:0 setp0 read or set output bits. 0 = read: output bit: write: no operation. 1 = read: output bit; write: set output bit. 0r/w 31:18 - reserved. 0 -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 80 of 313 nxp semiconductors um10601 chapter 7: lpc800 gpio port 7.6.9 gpio port toggle registers output bits can be toggled/inverted/complem ented by writing ones to these write-only registers, regardless of mask registers. 7.7 functional description 7.7.1 reading pin state software can read the state of all gpio pins except those selected for analog input or output in the ?i/o configuration? logic. a pin does not have to be selected for gpio in ?i/o configuration? in order to read its state. there are several ways to read the pin state: ? the state of a single pin can be read with 7 high-order zeros from a byte pin register. ? the state of a single pin can be read in all bits of a byte, halfword, or word from a word pin register. ? the state of multiple pins in a port can be read as a byte, halfword, or word from a port register. ? the state of a selected subset of the pins in a port can be read from a masked port (mport) register. pins having a 1 in the por t?s mask register will read as 0 from its mport register. 7.7.2 gpio output each gpio pin has an output bit in the gpio block. these output bits are the targets of write operations ?to the pins?. two conditions must be met in order for a pin?s output bit to be driven onto the pin: 1. the pin must be selected for gpio operation in the switch matrix. 2. the pin must be selected for output by a 1 in its port?s dir register. if either or both of these conditions is (are) not met, writing to the pin has no effect. there are multiple ways to change gpio output bits: table 76. gpio clear port 0 register (clr 0, address 0xa000 2280) bit description bit symbol description reset value access 17:0 clrp0 clear output bits: 0 = no operation. 1 = clear output bit. na wo 31:18 - reserved. 0 - table 77. gpio toggle port 0 register (n ot0, address 0xa000 2300) bit description bit symbol description reset value access 17:0 notp0 toggle output bits: 0 = no operation. 1 = toggle output bit. na wo 31:18 - reserved. 0 -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 81 of 313 nxp semiconductors um10601 chapter 7: lpc800 gpio port ? writing to a byte pin register loads the output bit from the least significant bit. ? writing to a word pin register loads the output bit with the or of all of the bits written. (this feature follows the definition of ?tru th? of a multi-bit value in programming languages.) ? writing to a port?s port register loads the output bits of all the pins written to. ? writing to a port?s mport register loads the output bits of pins identified by zeros in corresponding positions of the port?s mask register. ? writing ones to a port?s set register sets output bits. ? writing ones to a port?s clr register clears output bits. ? writing ones to a port?s not register toggles/complements/inverts output bits. the state of a port?s output bits can be read from its set register. reading any of the registers described in section 7.7.1 returns the state of pins, regardless of their direction or alternate functions. 7.7.3 masked i/o a port?s mask register defines which of its pins should be acce ssible in its mport register. zeroes in mask enable the corresponding pins to be read from and written to mport. ones in mask force a pin to read as 0 and its output bit to be unaffected by writes to mport. when a port ?s mask register contains a ll zeros, its port and mport registers operate identically for reading and writing. applications in which interrupts can result in masked gpio op eration, or in task switching among tasks that do masked gpio operation, must treat code that uses the mask register as a protected/restricted region. this can be done by interrupt disabling or by using a semaphore. the simpler way to protect a block of code that uses a mask register is to disable interrupts before setting the mask register, a nd re-enable them after the last operation that uses the mport or mask register. more efficiently, software can dedicate a semaphore to the mask registers, and set/capture the semaphore cont rolling exclusive use of the mask registers before setting the mask registers, and release the semaphor e after the last operation that uses the mport or mask registers. 7.7.4 recommended practices the following lists some recommended uses for using the gpio port registers: ? for initial setup after reset or re-ini tialization, write the port registers. ? to change the state of one pin, write a byte pin or word pin register. ? to change the state of multiple pins at a time, write the set and/or clr registers. ? to change the state of multiple pins in a tightly controlled environment like a software state machine, consider using the not register. this can require less write operations than set and clr. ? to read the state of one pin, read a byte pin or word pin register. ? to make a decision based on multiple pins, read and mask a port register.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 82 of 313 8.1 how to read this chapter the pin interrupt generator and the pattern match engine are available on all lpc800 parts. 8.2 features ? pin interrupts ? up to eight pins can be selected from a ll gpio pins as edge- or level-sensitive interrupt requests. each request creates a separate interrupt in the nvic. ? edge-sensitive interrupt pins can interrup t on rising or falling edges or both. ? level-sensitive interrupt pins can be high- or low-active. ? pattern match engine ? up to 8 pins can be selected from all gpio pins to contribute to a boolean expression. the boolean expression consists of specified levels and/or transitions on various combinations of these pins. ? each bit slice minterm (product term) comp rising the specified boolean expression can generate its own, dedicated interrupt request. ? any occurrence of a pattern match can be programmed to also generate an rxev notification to the arm cpu. the rxev signal can be connected to a pin. ? feature can be used, in conjunction with software, to create complex state machines based on pin inputs. 8.3 basic configuration ? pin interrupts: ? select up to eight external interrupt pins from all gpio port pins in the syscon block ( table 32 ). the pin selection process is the same for pin interrupts and the pattern match engine. the two fe atures are mutually exclusive. ? enable the clock to the pi n interrupt register bl ock in the sysahbclkctrl register ( ta b l e 1 8 , bit 6). ? if you want to use the pin interrupts to wake up the part from deep-sleep mode or power-down mode, enable the pin interrupt wake-up feature in the starterp0 register ( ta b l e 3 3 ). ? each selected pin interrupt is assigned to one interrupt in the nvic (interrupts #24 to #31 for pin interrupts 0 to 7). ? pattern match engine: ? select up to eight external pins from all gpio port pins in the syscon block ( table 32 ). the pin selection process is the same for pin interrupts and the pattern match engine. the two featur es are mutually exclusive. um10601 chapter 8: lpc800 pin interrupts/pattern match engine rev. 1.0 ? 7 november 2012 preliminary user manual
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 83 of 313 nxp semiconductors um10601 chapter 8: lpc800 pin interrupts/pattern match engine ? enable the clock to the pi n interrupt register bl ock in the sysahbclkctrl register ( ta b l e 1 8 , bit 6). ? each bit slice of the pattern match engine is assigned to one interrupt in the nvic (interrupts #24 to #31 for slices 0 to 7). ? the combined interrupt from all slices or slice combinations can be connected to the arm rxev request and to pin function gpio_int_bmat through the switch matrix movable function register (pinassign8, table 104 ). 8.3.1 configure pins as pin interrupts or as inputs to the pattern match engine follow these steps to configure pins as pin interrupts: 1. determine the pins that serve as pin interrupts on the lpc800 package. see the data sheet for determining the gpio port pin number associated with the package pin. 2. for each pin interrupt, program the gpio port pin number into one of the eight pintsel registers in the syscon block. remark: the port pin number serves to identify the pin to the pintsel register. any function, including gpio, can be assigned to this pin through the switch matrix. 3. enable each pin interrupt in the nvic. once the pin interrupts or pattern match inputs are configured, you can set up the pin interrupt detection levels or t he pattern match boolean expression. see section 4.6.27 ? pin interrupt select registers ? in the syscon block for the pintsel registers. 8.4 pin description the inputs to the pin interrupt and pattern match engine are determined by the pin interrupt select registers in the syscon block. see section 8.3.1 . the pattern match engine output is assigned to an external pin through the switch matrix. see section 9.3.1 ? connect an internal signal to a package pin ? for the steps that you need to follow to assign the gpio pattern ma tch function to a pin on the lpc800 package. 8.5 general description pins with configurable functions can serve as external interrupts or inputs to the pattern match engine. you can configure up to eight pi ns total using the pintsel registers in the syscon block for these features. table 78. sct pin description function direction pin description swm register reference gpio_int_bmat o any gpio pattern match output pinassign8 ta b l e 1 0 4
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 84 of 313 nxp semiconductors um10601 chapter 8: lpc800 pin interrupts/pattern match engine 8.5.1 pin interrupts from all available gpio pins, up to eight pins can be selected in the system control block to serve as external interrupt pins (see ta b l e 3 2 ). the external interrupt pins are connected to eight individual interrupts in the nvic and are created based on rising or falling edges or on the input level on the pin. 8.5.2 pattern match engine the pattern match feature allows complex boolean expressions to be constructed from the same set of eight gpio pins that were selected for the gpio pin interrupts. the pattern match logic continuously monitors th ese eight inputs and generates interrupts when any one or more minterms (product term s) of the specified bo olean expression is matched. a separate interrupt request is generated for each individual minterm. in addition, the pattern match module can be enabled to generate a receive event (rxev) output to the arm core when the entire boolean expressi on is true (i.e. when any minterm is matched). the rxev output is also be routed to gpio_int_bmat pin. this allows the gpio module to provide a rudimentary programmable logic capability employing up to eight inputs and one output. the pattern match function utilizes the same eight interrupt requ est lines as the pin interrupts so these two features are mutually exclusive as far as interrupt generation is concerned. a control bit is provided to select whether interrupt requests are generated in response to the standard pin interrupts or to pattern matches. no te that, if the pin interrupts are selected, the rxev request to the cpu can still be enabl ed for pattern matches. remark: pattern matching cannot be used to wake the part up from power-down modes. pin interrupts must be selected in order to use the gpio for wake-up. the pattern match module is constructed of eight bit-slice elements. each bit slice is programmed to represent one component of one minterm (product term) within the boolean expression. the interrupt request associat ed with the last bit slice for a particular minterm will be asserted whenever that minterm is matched. (see bit slice drawing figure 6 ). the pattern match capability ca n be used to create comple x software state machines. each minterm (and its corresponding individual interrupt) represents a different transition event to a new state. software can then establish the new set of conditions (i.e new boolean expression) that will cause a transition out of the current state.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 85 of 313 nxp semiconductors um10601 chapter 8: lpc800 pin interrupts/pattern match engine 8.5.2.1 example assume the expression: (in0)~(in1)(in3)^ + (i n1)(in2) + (in0)~(in3)~(in4) is specified through the registers pmsrc ( table 91 ) and pmcfg ( table 92 ). each term in the boolean expression, (in0), ~(in1), (in3)^, etc., represents one bit slice of the pattern match engine. ? in the first term (in0)~(in1)(in3)^, bit slic e 0 monitors for a high-level on input (in0), bit slice 1 monitors for a low level on in put (in1) and bit slice 2 monitors for a rising-edge on input (in3). if this combination is detected, that is if all three terms are true, the interrup t associated with bit slice 2 will be asserted. ? in the second term (in1 )(in2), bit slice 3 monitors input (in1) for a high level, bit slice 4 monitors input (in2) for a high level. if this combination is detected, the interrupt associated with bit slice 4 will be asserted. ? in the third term (in0)~(in3)~(in4), bit slice 5 monitors input (in0) for a high level, bit slice 6 monitors input (in3) for a low level, and bit slice 7 monitors input (in4) for a low level. if this combination is detected, the in terrupt associated with bit slice 7 will be asserted. ? the ored result of all th ree terms asserts the rxev re quest to the cpu and the gpio_int_bmat output. that is , if any of the three terms are true, the output is asserted. related links: section 8.7.2 fig 6. pattern ma tch bit slice 3 ,  &()-+ha6b 6$+ +(+!( a$(6! d :6(7 $d&!7 !"+%)b   /  8  > %"" +(+!( a$(6! d :6(7 $d&!7 !"+%)b 6$+ +(+!( a&#&$(6! db %"" +(+!( a&#&$(6! d 3  ,   / 8  > )#< )+*6#;$ "6!+ )#'-&'5($a6b # +2( "6!+ a6b a6b  %((+)&-%(!7a6b
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 86 of 313 nxp semiconductors um10601 chapter 8: lpc800 pin interrupts/pattern match engine 8.6 register description 8.6.1 pin interrupt mode register for each of the 8 pin interrupts selected in the pintseln registers (see section 4.6.27 ), one bit in the isel register determines whethe r the interrupt is edge or level sensitive. 8.6.2 pin interrupt level or rising edge interrupt enable register for each of the 8 pin interrupts selected in the pintseln registers (see section 4.6.27 ), one bit in the ienr register enables the interrupt depending on the pin interrupt mode configured in the isel register: ? if the pin interrupt mode is edge sensitive (pmode = 0), the rising edge interrupt is enabled. table 79. register overview: pin interrupts/ pattern match engine (base address: 0xa000 4000) name access address offset description reset value reference isel r/w 0x000 pin interrupt mode register 0 table 80 ienr r/w 0x004 pin interrupt level or rising edge interrupt enable register 0 table 81 sienr wo 0x008 pin interrupt level or rising edge interrupt set register na table 82 cienr wo 0x00c pin interrupt level (rising edge interrupt) clear register na table 83 ienf r/w 0x010 pin interrupt active level or falling edge interrupt enable register 0 table 84 sienf wo 0x014 pin interrupt active level or falling edge interrupt set register na table 85 cienf wo 0x018 pin interrupt active level or falling edge interrupt clear register na table 86 rise r/w 0x01c pin interrupt rising edge register 0 table 87 fall r/w 0x020 pin interrupt falling edge register 0 table 88 ist r/w 0x024 pin interrupt status register 0 table 89 pmctrl r/w 0x028 pattern match interrupt control register 0 table 90 pmsrc r/w 0x02c pattern match interrupt bit-slice source register 0 table 91 pmcfg r/w 0x030 pattern match interrupt bit slice configuration register 0 table 92 table 80. pin interrupt mode register (i sel, address 0xa000 4000) bit description bit symbol description reset value access 7:0 pmode selects the interrupt mode for each pin interrupt. bit n configures the pin interr upt selected in pintseln. 0 = edge sensitive 1 = level sensitive 0r/w 31:8 - reserved. - -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 87 of 313 nxp semiconductors um10601 chapter 8: lpc800 pin interrupts/pattern match engine ? if the pin interrupt mode is level sensitive (p mode = 1), the level in terrupt is enabled. the ienf register configures the active level (high or low) for this interrupt. 8.6.3 pin interrupt level or risi ng edge interrupt set register for each of the 8 pin interrupts selected in the pintseln registers (see section 4.6.27 ), one bit in the sienr register sets the correspo nding bit in the ienr register depending on the pin interrupt mode configured in the isel register: ? if the pin interrupt mode is edge sensitive (pmode = 0), the rising edge interrupt is set. ? if the pin interrupt mode is level sensitive (pmode = 1), the level inte rrupt is set. 8.6.4 pin interrupt level or risi ng edge interrupt clear register for each of the 8 pin interrupts selected in the pintseln registers (see section 4.6.27 ), one bit in the cienr register clears the corresponding bit in the ienr register depending on the pin interrupt mode configured in the isel register: ? if the pin interrupt mode is edge sensitive (pmode = 0), the rising edge interrupt is cleared. ? if the pin interrupt mode is le vel sensitive (pmode = 1), t he level interrupt is cleared. table 81. pin interrupt level or rising edge in terrupt enable register (ienr, address 0xa000 4004) bit description bit symbol description reset value access 7:0 enrl enables the rising edge or level interrupt for each pin interrupt. bit n configures the pin interrupt selected in pintseln. 0 = disable rising edge or level interrupt. 1 = enable rising edge or level interrupt. 0r/w 31:8 - reserved. - - table 82. pin interrupt level or rising edge interrupt set register (sienr, address 0xa000 4008) bit description bit symbol description reset value access 7:0 setenrl ones written to this ad dress set bits in the ienr, thus enabling interrupts. bit n sets bit n in the ienr register. 0 = no operation. 1 = enable rising edge or level interrupt. na wo 31:8 - reserved. - -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 88 of 313 nxp semiconductors um10601 chapter 8: lpc800 pin interrupts/pattern match engine 8.6.5 pin interrupt active level or fa lling edge interrupt enable register for each of the 8 pin interrupts selected in the pintseln registers (see section 4.6.27 ), one bit in the ienf register enables the falling edge interrupt or the configures the level sensitivity depending on the pin interrupt mode configured in the isel register: ? if the pin interrupt mode is edge sensitive (pmode = 0), the falling edge interrupt is enabled. ? if the pin interrupt mode is le vel sensitive (pmode = 1), the active level of the level interrupt (high or low) is configured. 8.6.6 pin interrupt active level or falling edge interrupt set register for each of the 8 pin interrupts selected in the pintseln registers (see section 4.6.27 ), one bit in the sienf register sets the correspo nding bit in the ienf register depending on the pin interrupt mode configured in the isel register: ? if the pin interrupt mode is edge sensitive (pmode = 0), the falling edge interrupt is set. ? if the pin interrupt mode is level sensitive (pmode = 1), the high-active interrupt is selected. table 83. pin interrupt level or rising edge in terrupt clear register (cienr, address 0xa000 400c) bit description bit symbol description reset value access 7:0 cenrl ones written to this addr ess clear bits in the ienr, thus disabling the interrupts. bit n clears bit n in the ienr register. 0 = no operation. 1 = disable rising edge or level interrupt. na wo 31:8 - reserved. - - table 84. pin interrupt active level or falling edge interrupt enable register (ienf, address 0xa000 4010) bit description bit symbol description reset value access 7:0 enaf enables the falling edge or conf igures the active level interrupt for each pin interrupt. bit n confi gures the pin interrupt selected in pintseln. 0 = disable falling edge interrupt or set active interrupt level low. 1 = enable falling edge interrupt enabled or set active interrupt level high. 0r/w 31:8 - reserved. - -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 89 of 313 nxp semiconductors um10601 chapter 8: lpc800 pin interrupts/pattern match engine 8.6.7 pin interrupt active level or falling edge interrupt clear register for each of the 8 pin interrupts selected in the pintseln registers (see section 4.6.27 ), one bit in the cienf register sets the correspo nding bit in the ienf register depending on the pin interrupt mode configured in the isel register: ? if the pin interrupt mode is edge sensitive (pmode = 0), the falling edge interrupt is cleared. ? if the pin interrupt mode is level sensitive (pmode = 1), the low-active interrupt is selected. 8.6.8 pin interrupt rising edge register this register contains ones for pin interrupts selected in the pintseln registers (see section 4.6.27 ) on which a rising edge has been detected. writing ones to this register clears rising edge detection. ones in this regi ster assert an interrupt request for pins that are enabled for rising-edge interrupts. all edges are detected for all pins selected by the pintseln registers, regardless of whether they are interrupt-enabled. table 85. pin interrupt active level or falling edge interrupt set register (sienf, address 0xa000 4014) bit description bit symbol description reset value access 7:0 setenaf ones written to this address set bits in the ienf, thus enabling interrupts. bit n sets bit n in the ienf register. 0 = no operation. 1 = select high-active interrupt or enable falling edge interrupt. na wo 31:8 - reserved. - - table 86. pin interrupt active level or falling edge interrupt clear register (cienf, address 0xa000 4018) bit description bit symbol description reset value access 7:0 cenaf ones written to this address clears bits in the ienf, thus disabling interrupts. bit n clears bit n in the ienf register. 0 = no operation. 1 = low-active interrupt selected or falling edge interrupt disabled. na wo 31:8 - reserved. - - table 87. pin interrupt rising edge register (rise, address 0xa000 401c) bit description bit symbol description reset value access 7:0 rdet rising edge detect. bit n detec ts the rising edge of the pin selected in pintseln. read 0: no rising edge has been detected on this pin since reset or the last time a one was written to this bit. write 0: no operation. read 1: a rising edge has been detected since reset or the last time a one was written to this bit. write 1: clear rising edge detection for this pin. 0r/w 31:8 - reserved. - -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 90 of 313 nxp semiconductors um10601 chapter 8: lpc800 pin interrupts/pattern match engine 8.6.9 pin interrupt falling edge register this register contains ones for pin interrupts selected in the pintseln registers (see section 4.6.27 ) on which a falling edge has been detect ed. writing ones to this register clears falling edge detect ion. ones in this register assert an interrupt request for pins that are enabled for falling-edge interrupts. all edge s are detected for all pins selected by the pintseln registers, regardless of whether they are interrupt-enabled. 8.6.10 pin interrupt status register reading this register returns ones for pin interrupts that are currently requesting an interrupt. for pins identified as edge-sensitive in the interrupt select register, writing ones to this register clears both rising- and falli ng-edge detection for the pin. for level-sensitive pins, writing ones inverts the corresponding bit in the active level r egister, thus switching the active level on the pin. 8.6.11 pattern match inte rrupt control register the pattern match control register contains one bit to select pattern-match interrupt generation (as opposed to pin interrupts which share the same interrupt request lines), and another to enable the rxev output to the cpu. this register also a llows the current state of any pattern matches to be read. if the pattern match feature is not used (e ither for interrupt gen eration or for rxev assertion) the two lsb?s of this register should be left at 0b00 to conserve power. table 88. pin interrupt falling edge register (fall, address 0xa000 4020) bit description bit symbol description reset value access 7:0 fdet falling edge detect. bit n detects the falling edge of the pin selected in pintseln. read 0: no falling edge has been detected on this pin since reset or the last time a one was written to this bit. write 0: no operation. read 1: a falling edge has bee n detected since reset or the last time a one was written to this bit. write 1: clear falling edge detection for this pin. 0r/w 31:8 - reserved. - - table 89. pin interrupt status register (ist, address 0xa000 4024) bit description bit symbol description reset value access 7:0 pstat pin interrupt status. bit n returns the status, clears the edge interrupt, or inverts the active level of the pin selected in pintseln. read 0: interrupt is not being r equested for this interrupt pin. write 0: no operation. read 1: interrupt is being requested for this interrupt pin. write 1 (edge-sensitive): clear rising- and falling-edge detection for this pin. write 1 (level-sensitive): switch the active level for this pin (in the ienf register). 0r/w 31:8 - reserved. - -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 91 of 313 nxp semiconductors um10601 chapter 8: lpc800 pin interrupts/pattern match engine remark: set up the pattern-match configuration in the pmsrc and pmcfg registers before writing to this register to enable (or re-enable) the pattern-match functionality. this eliminates the possibility of spurious interrupts as th e feature is being enabled. 8.6.12 pattern match interrupt bit-slice source register the bit-slice source register specifies the input source for each of the eight pattern match bit slices. each of the possible eight inputs is selected in the pin interrupt select registers in the syscon block. see section 4.6.27 . input 0 corresponds to the pin selected in the pintsel0 register, input 1 corresponds to th e pin selected in the pintsel1 register, and so forth. remark: writing any value to either the pmcfg register or the pmsrc register, or disabling the pattern-match feature (by clearing both the sel_pmatch and ena_rxev bits in the pmctrl register to ze ros) will erase all edge-detect history. table 90. pattern match interrupt control register (pmctrl, address 0x4004 c028) bit description bit symbol value description reset value 0 sel_pmatch specifies whether the 8 pin interrupts are controlled by the pin interrupt function or by the pattern match function. 0 0 pin interrupt. interrupts are driven in response to the standard pin interrupt function 1 pattern match. interrupts are driven in response to pattern matches. 1 ena_rxev enables the rxev output to the arm cpu and/or to a gpio output when the spec ified boolean expression evaluates to true. 0 0 disabled. rxev output to the cpu is disabled. 1 enabled. rxev output to the cpu is enabled. 23:2 - reserved. do not write 1s to unused bits. 0 31:24 pmat - this field displays the current state of pattern matches. a 1 in any bit of this field indicates that the corresponding product term is matched by the current state of the appropriate inputs. 0x0 table 91. pattern match bit-slice source register (pmsrc, address 0x4004 c02c) bit description bit symbol value description reset value 7:0 reserved software should not write 1s to unused bits. 0x0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 92 of 313 nxp semiconductors um10601 chapter 8: lpc800 pin interrupts/pattern match engine 10:8 src0 selects the input source for bit slice 0 000 0x0 input 0. selects pin interrupt input 0 as the source to bit slice 0. 0x1 input 1. selects pin interrupt input 1 as the source to bit slice 0. 0x2 input 2. selects pin interrupt input 2 as the source to bit slice 0. 0x3 input 3. selects pin interrupt input 3 as the source to bit slice 0. 0x4 input 4. selects pin interrupt input 4 as the source to bit slice 0. 0x5 input 5. selects pin interrupt input 5 as the source to bit slice 0. 0x6 input 6. selects pin interrupt input 6 as the source to bit slice 0. 0x7 input 7. selects pin interrupt input 7 as the source to bit slice 0. 13:11 src1 selects the input source for bit slice 1 000 0x0 input 0. selects pin interrupt input 0 as the source to bit slice 1. 0x1 input 1. selects pin interrupt input 1 as the source to bit slice 1. 0x2 input 2. selects pin interrupt input 2 as the source to bit slice 1. 0x3 input 3. selects pin interrupt input 3 as the source to bit slice 1. 0x4 input 4. selects pin interrupt input 4 as the source to bit slice 1. 0x5 input 5. selects pin interrupt input 5 as the source to bit slice 1. 0x6 input 6. selects pin interrupt input 6 as the source to bit slice 1. 0x7 input 7. selects pin interrupt input 7 as the source to bit slice 1. 16:14 src2 selects the input source for bit slice 2 000 0x0 input 0. selects pin interrupt input 0 as the source to bit slice 2. 0x1 input 1. selects pin interrupt input 1 as the source to bit slice 2. 0x2 input 2. selects pin interrupt input 2 as the source to bit slice 2. 0x3 input 3. selects pin interrupt input 3 as the source to bit slice 2. 0x4 input 4. selects pin interrupt input 4 as the source to bit slice 2. 0x5 input 5. selects pin interrupt input 5 as the source to bit slice 2. 0x6 input 6. selects pin interrupt input 6 as the source to bit slice 2. 0x7 input 7. selects pin interrupt input 7 as the source to bit slice 2. 19:17 src3 selects the input source for bit slice 3 000 0x0 input 0. selects pin interrupt input 0 as the source to bit slice 3. 0x1 input 1. selects pin interrupt input 1 as the source to bit slice 3. 0x2 input 2. selects pin interrupt input 2 as the source to bit slice 3. 0x3 input 3. selects pin interrupt input 3 as the source to bit slice 3. 0x4 input 4. selects pin interrupt input 4 as the source to bit slice 3. 0x5 input 5. selects pin interrupt input 5 as the source to bit slice 3. 0x6 input 6. selects pin interrupt input 6 as the source to bit slice 3. 0x7 input 7. selects pin interrupt input 7 as the source to bit slice 3. table 91. pattern match bit-slice source register (pmsrc, address 0x4004 c02c) bit description bit symbol value description reset value
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 93 of 313 nxp semiconductors um10601 chapter 8: lpc800 pin interrupts/pattern match engine 22:20 src4 selects the input source for bit slice 4 000 0x0 input 0. selects pin interrupt input 0 as the source to bit slice 4. 0x1 input 1. selects pin interrupt input 1 as the source to bit slice 4. 0x2 input 2. selects pin interrupt input 2 as the source to bit slice 4. 0x3 input 3. selects pin interrupt input 3 as the source to bit slice 4. 0x4 input 4. selects pin interrupt input 4 as the source to bit slice 4. 0x5 input 5. selects pin interrupt input 5 as the source to bit slice 4. 0x6 input 6. selects pin interrupt input 6 as the source to bit slice 4. 0x7 input 7. selects pin interrupt input 7 as the source to bit slice 4. 25:23 src5 selects the input source for bit slice 5 000 0x0 input 0. selects pin interrupt input 0 as the source to bit slice 5. 0x1 input 1. selects pin interrupt input 1 as the source to bit slice 5. 0x2 input 2. selects pin interrupt input 2 as the source to bit slice 5. 0x3 input 3. selects pin interrupt input 3 as the source to bit slice 5. 0x4 input 4. selects pin interrupt input 4 as the source to bit slice 5. 0x5 input 5. selects pin interrupt input 5 as the source to bit slice 5. 0x6 input 6. selects pin interrupt input 6 as the source to bit slice 5. 0x7 input 7. selects pin interrupt input 7 as the source to bit slice 5. 28:26 src6 selects the input source for bit slice 6 000 0x0 input 0. selects pin interrupt input 0 as the source to bit slice 6. 0x1 input 1. selects pin interrupt input 1 as the source to bit slice 6. 0x2 input 2. selects pin interrupt input 2 as the source to bit slice 6. 0x3 input 3. selects pin interrupt input 3 as the source to bit slice 6. 0x4 input 4. selects pin interrupt input 4 as the source to bit slice 6. 0x5 input 5. selects pin interrupt input 5 as the source to bit slice 6. 0x6 input 6. selects pin interrupt input 6 as the source to bit slice 6. 0x7 input 7. selects pin interrupt input 7 as the source to bit slice 6. 31:29 src7 selects the input source for bit slice 7 000 0x0 input 0. selects pin interrupt input 0 as the source to bit slice 7. 0x1 input 1. selects pin interrupt input 1 as the source to bit slice 7. 0x2 input 2. selects pin interrupt input 2 as the source to bit slice 7. 0x3 input 3. selects pin interrupt input 3 as the source to bit slice 7. 0x4 input 4. selects pin interrupt input 4 as the source to bit slice 7. 0x5 input 5. selects pin interrupt input 5 as the source to bit slice 7. 0x6 input 6. selects pin interrupt input 6 as the source to bit slice 7. 0x7 input 7. selects pin interrupt input 7 as the source to bit slice 7. table 91. pattern match bit-slice source register (pmsrc, address 0x4004 c02c) bit description bit symbol value description reset value
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 94 of 313 nxp semiconductors um10601 chapter 8: lpc800 pin interrupts/pattern match engine 8.6.13 pattern match interrupt bit-slice configuration register the bit-slice configuration regi ster contains bits to select from among eight alternative conditions for each bit slice that will cause that bit slice to contribute to a pattern match. the seven lsb?s of this register specify which bit-slices are the end-points of product terms in the boolean expression (i.e. where or terms are to be inserted in the expression). this bit is only cleared when the pmcfg or the pmsrc registers are written to. remark: writing any value to either the pmcfg register or the pmsrc register, or disabling the pattern-match feature (by clearing both the sel_pmatch and ena_rxev bits in the pmctrl register to ze ros) will erase all edge-detect history. table 92. pattern match bit slice configuration re gister (pmcfg, address 0x4004 c030) bit description bit symbol value description reset value 6:0 prod_ endpts a 1 in any bit of this field causes the corre sponding bit slice to be the final component of a product term in the boolean expression. this has two effects: 1. the interrupt request associated with this bit-slice will be asserted whenever a match to that product term is detected. 2. the next bit slice will start a new, independent product term in the boolean expression (i.e. an or will be inserted in the boolean expression following the element controlled by this bit slice). 0x0 7 reserved (bit slice 7 is automatically considered a product end point) 0 10:8 cfg0 specifies the match-contribution condition for bit slice 0. 0b000 0x0 constant 1. this bit slice always contributes to a product term match. 0x1 rising edge. match occurs if a rising edg e on the specified input has occurred since the last time the edge detection for this bit slice was cleared. this bit is only cleared when the pmcfg or the pmsrc registers are written to. 0x2 falling edge. match occurs if a falling edge on the specified input has occurred since the last time the edge detection for this bit slice was cleared. this bit is only cleared when the pmcfg or the pmsrc registers are written to. 0x3 rising or falling edge. match occurs if ei ther a rising or falling edge on the specified input has occurred since the last time the edge detection for this bit slice was cleared. this bit is only cleared when the pmcfg or the pmsrc registers are written to. 0x4 high level. match (for this bit slice) o ccurs when there is a high level on the input specified for this bit slice in the pmsrc register. 0x5 low level. match occurs when there is a low level on the specified input. 0x6 constant 0. this bit slice never contributes to a match ( should be used to disable any unused bit slices) 0x7 event. match occurs on an event - i.e. when either a rising or falling edge is first detected on the specified input (this is a non-sticky version of option 3)
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 95 of 313 nxp semiconductors um10601 chapter 8: lpc800 pin interrupts/pattern match engine 13:11 cfg1 specifies the match-contribution condition for bit slice 1. 0b000 0x0 constant 1. this bit slice always contributes to a product term match. 0x1 rising edge. match occurs if a rising edg e on the specified input has occurred since the last time the edge detection for this bit slice was cleared. this bit is only cleared when the pmcfg or the pmsrc registers are written to. 0x2 falling edge. match occurs if a falling edge on the specified input has occurred since the last time the edge detection for this bit slice was cleared. this bit is only cleared when the pmcfg or the pmsrc registers are written to. 0x3 rising or falling edge. match occurs if ei ther a rising or falling edge on the specified input has occurred since the last time the edge detection for this bit slice was cleared. this bit is only cleared when the pmcfg or the pmsrc registers are written to. 0x4 high level. match (for this bit slice) o ccurs when there is a high level on the input specified for this bit slice in the pmsrc register. 0x5 low level. match occurs when there is a low level on the specified input. 0x6 constant 0. this bit slice never contributes to a match ( should be used to disable any unused bit slices) 0x7 event. match occurs on an event - i.e. when either a rising or falling edge is first detected on the specified input (this is a non-sticky version of option 3) 16:14 cfg2 specifies the match-contribution condition for bit slice 2. 0b000 0x0 constant 1. this bit slice always contributes to a product term match. 0x1 rising edge. match occurs if a rising edg e on the specified input has occurred since the last time the edge detection for this bit slice was cleared. this bit is only cleared when the pmcfg or the pmsrc registers are written to. 0x2 falling edge. match occurs if a falling edge on the specified input has occurred since the last time the edge detection for this bit slice was cleared. this bit is only cleared when the pmcfg or the pmsrc registers are written to. 0x3 rising or falling edge. match occurs if ei ther a rising or falling edge on the specified input has occurred since the last time the edge detection for this bit slice was cleared. this bit is only cleared when the pmcfg or the pmsrc registers are written to. 0x4 high level. match (for this bit slice) o ccurs when there is a high level on the input specified for this bit slice in the pmsrc register. 0x5 low level. match occurs when there is a low level on the specified input. 0x6 constant 0. this bit slice never contributes to a match ( should be used to disable any unused bit slices) 0x7 event. match occurs on an event - i.e. when either a rising or falling edge is first detected on the specified input (this is a non-sticky version of option 3) table 92. pattern match bit slice configuration re gister (pmcfg, address 0x4004 c030) bit description ?continued bit symbol value description reset value
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 96 of 313 nxp semiconductors um10601 chapter 8: lpc800 pin interrupts/pattern match engine 19:17 cfg3 specifies the match-contribution condition for bit slice 3. 0b000 0x0 constant 1. this bit slice always contributes to a product term match. 0x1 rising edge. match occurs if a rising edg e on the specified input has occurred since the last time the edge detection for this bit slice was cleared. this bit is only cleared when the pmcfg or the pmsrc registers are written to. 0x2 falling edge. match occurs if a falling edge on the specified input has occurred since the last time the edge detection for this bit slice was cleared. this bit is only cleared when the pmcfg or the pmsrc registers are written to. 0x3 rising or falling edge. match occurs if ei ther a rising or falling edge on the specified input has occurred since the last time the edge detection for this bit slice was cleared. this bit is only cleared when the pmcfg or the pmsrc registers are written to. 0x4 high level. match (for this bit slice) o ccurs when there is a high level on the input specified for this bit slice in the pmsrc register. 0x5 low level. match occurs when there is a low level on the specified input. 0x6 constant 0. this bit slice never contributes to a match ( should be used to disable any unused bit slices) 0x7 event. match occurs on an event - i.e. when either a rising or falling edge is first detected on the specified input (this is a non-sticky version of option 3) 22:20 cfg4 specifies the match-contribution condition for bit slice 4. 0b000 0x0 constant 1. this bit slice always contributes to a product term match. 0x1 rising edge. match occurs if a rising edg e on the specified input has occurred since the last time the edge detection for this bit slice was cleared. this bit is only cleared when the pmcfg or the pmsrc registers are written to. 0x2 falling edge. match occurs if a falling edge on the specified input has occurred since the last time the edge detection for this bit slice was cleared. this bit is only cleared when the pmcfg or the pmsrc registers are written to. 0x3 rising or falling edge. match occurs if ei ther a rising or falling edge on the specified input has occurred since the last time the edge detection for this bit slice was cleared. this bit is only cleared when the pmcfg or the pmsrc registers are written to. 0x4 high level. match (for this bit slice) o ccurs when there is a high level on the input specified for this bit slice in the pmsrc register. 0x5 low level. match occurs when there is a low level on the specified input. 0x6 constant 0. this bit slice never contributes to a match ( should be used to disable any unused bit slices) 0x7 event. match occurs on an event - i.e. when either a rising or falling edge is first detected on the specified input (this is a non-sticky version of option 3) table 92. pattern match bit slice configuration re gister (pmcfg, address 0x4004 c030) bit description ?continued bit symbol value description reset value
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 97 of 313 nxp semiconductors um10601 chapter 8: lpc800 pin interrupts/pattern match engine 25:23 cfg5 specifies the match-contribution condition for bit slice 5. 0b000 0x0 constant 1. this bit slice always contributes to a product term match. 0x1 rising edge. match occurs if a rising edg e on the specified input has occurred since the last time the edge detection for this bit slice was cleared. this bit is only cleared when the pmcfg or the pmsrc registers are written to. 0x2 falling edge. match occurs if a falling edge on the specified input has occurred since the last time the edge detection for this bit slice was cleared. this bit is only cleared when the pmcfg or the pmsrc registers are written to. 0x3 rising or falling edge. match occurs if ei ther a rising or falling edge on the specified input has occurred since the last time the edge detection for this bit slice was cleared. this bit is only cleared when the pmcfg or the pmsrc registers are written to. 0x4 high level. match (for this bit slice) o ccurs when there is a high level on the input specified for this bit slice in the pmsrc register. 0x5 low level. match occurs when there is a low level on the specified input. 0x6 constant 0. this bit slice never contributes to a match ( should be used to disable any unused bit slices) 0x7 event. match occurs on an event - i.e. when either a rising or falling edge is first detected on the specified input (this is a non-sticky version of option 3) 28:26 cfg6 specifies the match-contribution condition for bit slice 6. 0b000 0x0 constant 1. this bit slice always contributes to a product term match. 0x1 rising edge. match occurs if a rising edg e on the specified input has occurred since the last time the edge detection for this bit slice was cleared. this bit is only cleared when the pmcfg or the pmsrc registers are written to. 0x2 falling edge. match occurs if a falling edge on the specified input has occurred since the last time the edge detection for this bit slice was cleared. this bit is only cleared when the pmcfg or the pmsrc registers are written to. 0x3 rising or falling edge. match occurs if ei ther a rising or falling edge on the specified input has occurred since the last time the edge detection for this bit slice was cleared. this bit is only cleared when the pmcfg or the pmsrc registers are written to. 0x4 high level. match (for this bit slice) o ccurs when there is a high level on the input specified for this bit slice in the pmsrc register. 0x5 low level. match occurs when there is a low level on the specified input. 0x6 constant 0. this bit slice never contributes to a match ( should be used to disable any unused bit slices) 0x7 event. match occurs on an event - i.e. when either a rising or falling edge is first detected on the specified input (this is a non-sticky version of option 3) table 92. pattern match bit slice configuration re gister (pmcfg, address 0x4004 c030) bit description ?continued bit symbol value description reset value
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 98 of 313 nxp semiconductors um10601 chapter 8: lpc800 pin interrupts/pattern match engine 8.7 functional description 8.7.1 pin interrupts in this interrupt facility, up to 8 pins are identified as in terrupt sources by the pin interrupt select registers (pintsel0-7). all registers in the pin interrupt block contain 8 bits, corresponding to the pins called out by the pintsel0-7 registers. the isel register defines whether each interrupt pin is edge - or level-sensitive. the rise and fall registers detect edges on each interrupt pin, and can be written to clear (and set) edge detection. the ist register indicates whether ea ch interrupt pin is currently requesting an interrupt, and this register can also be written to clear interrupts. the other pin interrupt registers play differen t roles for edge-sensitive and level-sensitive pins, as described in ta b l e 9 3 . 31:29 cfg7 specifies the match-contribution condition for bit slice 7. 0b000 0x0 constant 1. this bit slice always contributes to a product term match. 0x1 rising edge. match occurs if a rising edg e on the specified input has occurred since the last time the edge detection for this bit slice was cleared. this bit is only cleared when the pmcfg or the pmsrc registers are written to. 0x2 falling edge. match occurs if a falling edge on the specified input has occurred since the last time the edge detection for this bit slice was cleared. this bit is only cleared when the pmcfg or the pmsrc registers are written to. 0x3 rising or falling edge. match occurs if ei ther a rising or falling edge on the specified input has occurred since the last time the edge detection for this bit slice was cleared. this bit is only cleared when the pmcfg or the pmsrc registers are written to. 0x4 high level. match (for this bit slice) o ccurs when there is a high level on the input specified for this bit slice in the pmsrc register. 0x5 low level. match occurs when there is a low level on the specified input. 0x6 constant 0. this bit slice never contributes to a match ( should be used to disable any unused bit slices) 0x7 event. match occurs on an event - i.e. when either a rising or falling edge is first detected on the specified input (this is a non-sticky version of option 3) table 92. pattern match bit slice configuration re gister (pmcfg, address 0x4004 c030) bit description ?continued bit symbol value description reset value table 93. pin interrupt registers fo r edge- and level-sensitive pins name edge-sensiti ve function level-sensitive function ienr enables rising-edge interrupts. enables level interrupts. sienr write to enable rising-edge interrupts. write to enable level interrupts. cienr write to disable rising-edge interrupts. write to disable level interrupts. ienf enables falling-edge interrupts. selects active level. sienf write to enable falling-edge interrupts. write to select high-active. cienf write to disable falling-edge interrupts. write to select low-active.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 99 of 313 nxp semiconductors um10601 chapter 8: lpc800 pin interrupts/pattern match engine 8.7.2 pattern match engine example suppose the desired boolean pattern to be matched is: (in1) + (in1 * in2) + (~in2 * ~in3 * in6fe) + (in5 * in7ev) with: in6fe = (sticky) falling-edge on input 6 in7ev = (non-sticky) event (ris ing or falling edge) on input 7 each individual term in the expression shown above is controlled by one bit-slice. to specify this expression, program the patter n match bit slice source and configuration register fields as follows: ? pmsrc register ( ta b l e 9 1 ): ? clr_edgedet: a 1 may be written to bit 5 to clear any pre-existing edge detects on bit-slice 5, if that is what is desired. ? src0: 001 - select input 1 for bit slice 0 ? src1: 001 - select input 1 for bit slice 1 ? src2: 010 - select input 2 for bit slice 2 ? src3: 010 - select input 2 for bit slice 3 ? src4: 011 - select input 3 for bit slice 4 ? src5: 110 - select input 6 for bit slice 5 ? src6: 101 - select input 5 for bit slice 6 ? src7: 111 - select input 7 for bit slice 7 ? pmctrl register ( table 90 ): ? bit[0]: setting this bit will select pattern ma tches to generate th e pin interrupts in place of the normal pin interrupt mechanism. for this example, pin interrupt 0 will be a sserted when a match is detected on the first product term (which, in this case , is just a high level on input 1). pin interrupt 2 will be asserted in response to a match on the second product term. pin interrupt 5 will be assert ed when there is a match on the third product term. pin interrupt 7 will be asserted on a match on the last term. ? bit[1]: setting this bit will cause the rxev signal to the arm cpu to be asserted whenever a match occurs on any of the product terms in the expression. otherwise, the rxev line will not be used. ? bit[31:24]: at any given time, bits 0, 2, 5 and/or 7 may be high if the corresponding product terms are currently matching. ? the remaining bits will always be low.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 100 of 313 9.1 how to read this chapter the switch matrix is identical for all lpc800 parts. the usart2 and spi1 functions are only available on parts LPC812M101FDH20 and lpc812m101fdh16 and the corresponding switch matrix select bits are reserved for all other parts. 9.2 features ? flexible assignment of digital peripheral functions to pins ? enable/disable of analog functions 9.3 basic configuration once configured, no clocks are needed for the switch matrix to function. the system clock is needed only to write to or read from the pi n assignment registers. after the switch matrix is configured, disable the clock to the s witch matrix block in the sysahbclkctrl register. before activating a peripheral or enabling its interrupt, use the switch matrix to connect the peripheral to external pins. the boot loader assigns the swd functions to pins pio0_2 and pio0_3. if the user code disables the swd functions thr ough the switch matrix to use the pins for other functions, the swd port is disabled. remark: for the purpose of programming the pin functions through the switch matrix, every pin except the power and ground pins is identified in a package-independent way by its gpio port pin number. um10601 chapter 9: lpc800 switch matrix rev. 1.0 ? 7 november 2012 preliminary user manual
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 101 of 313 nxp semiconductors um10601 chapter 9: lpc800 switch matrix 9.3.1 connect an internal signal to a package pin the switch matrix connects all internal signa ls listed in the table of movable functions through the pin assignment registers to exte rnal pins on the package. external pins are identified by their default gp io pin number pio0_n. follow these steps to connect an internal signal func to an ex ternal pin. an example of a movable function is the uart transmit signal txd: 1. find the function func in the list of movable function in ta b l e 9 4 or in the data sheet. 2. use the lpc800 data sheet to decide whic h pin x on the lpc800 package to connect func to. 3. use the pin description table to find the default gpio function pio0_n assigned to package pin x. m is the pin number. 4. locate the pin assignment register for the fu nction func in the switch matrix register description. 5. disable any special functions on pin pio0_n in the pinenable0 register. 6. program the pin number n into the bits assigned to func. func is now connected to pin x on the package. 9.3.2 enable an analog input or other special function the switch matrix enables func tions that can only be assigned to one pin. examples are analog inputs, all gpio pins, and the debug swd pins. a pin is identified for the purpose of programming the switch matrix by its default gpio port pin. fig 7. example: connect function u0_rxd and u0_txd to pins 8 and 14 on the so20 package   ,-> ,- ,-/ ,-,-  ,- ,-4  ,-8 ,-> ,-   4  ,-/  4  ,-  ,-3  ,- ,-?3  ,-, ,--  ,- ,-8   / 8  >  ? ,    /  8  > , ? ,-
g 56&
&; '6$%c"+
3   ,
c6(

i
 %$$6=&

i
,- 3 ,
c6($
>0,
i
,2 9;&!(6#&
,- 3
%$$6=&+'
(#
,
5%! %=+ 56&
 ,-
g 56&
&; %$$6=&

i
,-3 ,
c6($
80
i
,2, 9;&!(6#&
,-3
%$$6=&+'
(#
,
5%! %=+ 56&
,

draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 102 of 313 nxp semiconductors um10601 chapter 9: lpc800 switch matrix ? if you want to assign a gpio pin to a pin on any lpc800 package, disable any special function available on this pin in the pinenable0 register and do not assign any movable function to it. by default, all pins except pins pio0_2 , pio0_3, and pio0_5 are assigned to gpio. ? for all other functions that are not in the table of movable functions, do the following: a. locate the function in the pin description table in the data sheet. this shows the package pin for this function. b. enable the function in the pinenable0 re gister. all other possible functions on this pins are now disabled. 9.4 general description the switch matrix connects internal signals (functions) to external pins. functions are signals coming from or going to a single pin on the package and coming from or going to an on-chip peripheral block. examples of functions are the gpios, the uart transmit output (txd), or the clock output clkout. many peripherals have several functions that must be connected to external pins. on the lpc800, most functions can be assigned through the switch matrix to any external pin that is not a power or ground pin. th ese functions are called movable functions. a few functions like the crystal oscillator pins (xtalin/xtalout) or the analog comparator inputs can only be assigned to one particular external pin with the appropriate electrical characteristics. these functions ar e called fixed-pin functions. if a fixed-pin function is not used, it can be re placed by any other movable function. gpios are fixed-pin functions. each gpio is assigned to one and only one external pin. by default, all external pins have the gpio function assigned. extern al pins are therefore identified by their fixe d-pin gpio function. 9.4.1 movable functions table 94. movable functions (assign to pins pio0_0 to pio_17 through switch matrix) function name type description swm pin assign register reference u0_txd o transmitter output for usart0. pinassign0 table 96 u0_rxd i receiver input for usart0. pinassign0 table 96 u0_rts o request to send output for usart0. pinassign0 table 96 u0_cts i clear to send input for usart0. pinassign0 table 96 u0_sclk i/o serial clock input/output for usart0 in synchronous mode. pinassign1 table 97 u1_txd o transmitter output for usart1. pinassign1 table 97 u1_rxd i receiver input for usart1. pinassign1 table 97 u1_rts o request to send output for usart1. pinassign1 table 97 u1_cts i clear to send input for usart1. pinassign2 table 98 u1_sclk i/o serial clock input/output for usart1 in synchronous mode. pinassign2 table 98 u2_txd o transmitter output for usart2. pinassign2 table 98
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 103 of 313 nxp semiconductors um10601 chapter 9: lpc800 switch matrix 9.4.2 switch matrix register interface the switch matrix consists of two blocks of pin-assignment registers pinassign and pinenable. every function has an assigned fiel d (1-bit or 8-bit wide) within this bank of registers where you can program the external pin - identified by its gpio function - you want the function to connect to. gpios range from pio0_0 to pio0_17 and, for assignment through the pin-assignment registers, are numbered 0 to 17. there are two types of functions which must be assigned to port pins in different ways: u2_rxd i receiver input for usart2. pinassign2 table 98 u2_rts o request to send output for usart1. pinassign3 table 99 u2_cts i clear to send input for usart1. pinassign3 table 99 u2_sclk i/o serial clock input/output for usart1 in synchronous mode. pinassign3 table 99 spi0_sck i/o serial clock for spi0. pinassign3 table 99 spi0_mosi i/o master out slav e in for spi0. pinassign4 table 100 spi0_miso i/o master in slav e out for spi0. pinassign4 table 100 spi0_ssel i/o slave select for spi0. pinassign4 table 100 spi1_sck i/o serial clock for spi1. pinassign4 table 100 spi1_mosi i/o master out slav e in for spi1. pinassign5 table 101 spi1_miso i/o master in slav e out for spi1. pinassign5 table 101 spi1_ssel i/o slave select for spi1. pinassign5 table 101 ctin_0 i sct input 0. pinassign5 table 101 ctin_1 i sct input 1. pinassign6 table 102 ctin_2 i sct input 2. pinassign6 table 102 ctin_3 i sct input 3. pinassign6 table 102 ctout_0 o sct output 0. pinassign6 table 102 ctout_1 o sct output 1. pinassign7 table 103 ctout_2 o sct output 2. pinassign7 table 103 ctout_3 o sct output 3. pinassign7 table 103 i2c0_sda i/o i 2 c-bus data input/output (open-drain if assigned to pin pio0_11). high-current sink only if assigned to pin pio0_11 and if i 2 c fast-mode plus is selected in the i/o configuration register. pinassign7 table 103 i2c0_scl i/o i 2 c-bus clock input/output (open-drain if assigned to pin pio0_10). high-current sink on ly if assigned to pio0_10 and if i 2 c fast-mode plus is selected in the i/o configuration register. pinassign8 table 104 acmp_o o analog comparator output. pinassign8 table 104 clkout o clock output. pinassign8 table 104 gpio_int_bmat o output of the pattern match engine. pinassign8 table 104 table 94. movable functions (assign to pins pio0_0 to pio_17 through switch matrix) function name type description swm pin assign register reference
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 104 of 313 nxp semiconductors um10601 chapter 9: lpc800 switch matrix 1. movable functions (pinassign0 to 8): all movable functions are digital functions. assign movable functions to pin numbers through the 8 bits of the pi nassign register associated wit h this function. once the function is assigned a pin pio0_n, it is conne cted through this pin to a physical pin on the package. remark: you can assign only one digital output function to an external pin at any given time. remark: you can assign more than one digital input function to one external pin. 2. fixed-pin functions (pinenable0): some functions require pins with special characteristics and cannot be moved to other physical pins. hence these functions are mapped to a fixed port pin. examples of fixed-pin functions are the osc illator pins or comparator inputs. each fixed-pin function is associated with one bit in the pinenable0 register which selects or deselects the function. ? if a fixed-pin function is deselected, any movable function can be assigned to its port and pin. ? if a fixed-pin function is deselected and no movable function is assigned to this pin, the pin is gpio. ? on reset, all fixed-pin functions are deselected. ? if a fixed-pin function is selected, its assigned pin can not be used for any other function. 9.5 register description table 95. register overview: switch matrix (base address 0x4000 c000) name access offset description reset value reference pinassign0 r/w 0x000 pin assign register 0. assign movable functions u0_txd, u0_rxd, u0_rts, u0_cts 0xffff ffff ta b l e 9 6 pinassign1 r/w 0x004 pin assign register 1. assign movable functions u0_sclc, u1_txd, u1_rxd 0xffff ffff ta b l e 9 7 pinassign2 r/w 0x008 pin assign register 2. assign movable functions u2_txd, u2_rxd 0xffff ffff ta b l e 9 8 pinassign3 r/w 0x00c pin assignregister 3. assign movable function spi0_sck 0xffff ffff ta b l e 9 9 pinassign4 r/w 0x010 pin assign register 4. assign movable functions spi0_mosi, spi0_miso, spi0_ssel, spi1_sck 0xffff ffff table 100 pinassign5 r/w 0x014 pin assign register 5. assign movable functions spi1_mosi, spi1_miso, spi1_ssel, ctin_0 0xffff ffff table 101 pinassign6 r/w 0x018 pin assign register 6. assign movable functions ctin_1, ctin_2, ctin_3, ctout_0 0xffff ffff table 102
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 105 of 313 nxp semiconductors um10601 chapter 9: lpc800 switch matrix 9.5.1 pin assign register 0 9.5.2 pin assign register 1 pinassign7 r/w 0x01c pin assign egister 7. assign movable functions ctout_1, ctout_2, ctout_3, i2c_sda 0xffff ffff table 103 pinassign8 r/w 0x020 pin assign register 8. assign movable functions i2c_scl, acmp_o, clkout, gpio_int_bmat 0xffff ffff table 104 - - 0x024 reserved - - pinenable0 r/w 0x1c0 pin enable register 0. enables fixed-pin functions acmp_i0, acmp_i1, swclk, swdio, xtalin, xtalout, reset , clkin, vddcmp 0x1b3 table 105 table 95. register overview: switch matrix (base address 0x4000 c000) ?continued name access offset description reset value reference table 96. pin assign register 0 (pinassign0, address 0x4000 c000) bit description bit symbol description reset value 7:0 u0_txd_o u0_txd function assignment. the value is the pin number to be assigned to this function. the fo llowing pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff 15:8 u0_rxd_i u0_rxd function assignment. the value is the pin number to be assigned to this function. the fo llowing pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff 23:16 u0_rts_o u0_rts function assignment. the value is the pin number to be assigned to this function. the fo llowing pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff 31:24 u0_cts_i u0_cts function assignment. the value is the pin number to be assigned to this function. the fo llowing pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff table 97. pin assign register 1 (pinassign1, address 0x4000 c004) bit description bit symbol description reset value 7:0 u0_sclk_io u0_sclk function assignment . the value is the pin number to be assigned to this function. the fo llowing pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff 15:8 u1_txd_o u1_txd function assignment. the value is the pin number to be assigned to this function. the fo llowing pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff 23:16 u1_rxd_i u1_rxd function assignment. the value is the pin number to be assigned to this function. the fo llowing pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff 31:24 u1_rts_o u1_rts function assignment. the value is the pin number to be assigned to this function. the fo llowing pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 106 of 313 nxp semiconductors um10601 chapter 9: lpc800 switch matrix 9.5.3 pin assign register 2 9.5.4 pin assign register 3 9.5.5 pin assign register 4 table 98. pin assign register 2 (pinassign2, address 0x4000 c008) bit description bit symbol description reset value 7:0 u1_cts_i u1_cts function assignment. the value is the pin number to be assigned to this function. the fo llowing pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff 15:8 u1_sclk_io u1_sclk function assignment . the value is the pin number to be assigned to this function. the fo llowing pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff 23:16 u2_txd_o u2_txd function assignment. the value is the pin number to be assigned to this function. the fo llowing pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff 31:24 u2_rxd_i u2_rxd function assignment. the value is the pin number to be assigned to this function. the fo llowing pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff table 99. pin assign register 3 (pinassign3, address 0x4000 c00c) bit description bit symbol description reset value 7:0 u2_rts_o u2_rts function assignment. the value is the pin number to be assigned to this function. the fo llowing pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff 15:8 u2_cts_i u2_cts function assignment. the value is the pin number to be assigned to this function. the fo llowing pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff 23:16 u2_sclk_io u2_sclk function assignment . the value is the pin number to be assigned to this function. the fo llowing pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff 31:24 spi0_sck_io spi0_sck function assignment. the value is the pin number to be assigned to this function. the following pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff table 100. pin assign register 4 (pinassign4, address 0x4000 c010) bit description bit symbol description reset value 7:0 spi0_mosi_io spi0_mosi function assign ment. the value is the pin number to be assigned to this function. the following pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 107 of 313 nxp semiconductors um10601 chapter 9: lpc800 switch matrix 9.5.6 pin assign register 5 9.5.7 pin assign register 6 15:8 spi0_miso_io spi0_misio function assi gnment. the value is the pin number to be assigned to this function. the following pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff 23:16 spi0_ssel_io spi0_ssel function assign ment. the value is the pin number to be assigned to this function. the following pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff 31:24 spi1_sck_io spi1_sck function assignm ent. the value is the pin number to be assigned to this function. the following pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff table 100. pin assign register 4 (pinassign4, address 0x4000 c010) bit description bit symbol description reset value table 101. pin assign register 5 (pinassign5, address 0x4000 c014) bit description bit symbol description reset value 7:0 spi1_mosi_io spi1_mosi function assign ment. the value is the pin number to be assigned to this function. the following pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff 15:8 spi1_miso_io spi1_misio function assi gnment. the value is the pin number to be assigned to this function. the following pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff 23:16 spi1_ssel_io spi1_ssel function assign ment. the value is the pin number to be assigned to this function. the following pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff 31:24 ctin_0_i ctin_0 function assignment. the value is the pin number to be assigned to this function. the following pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff table 102. pin assign register 6 (pinassign6, address 0x4000 c018) bit description bit symbol description reset value 7:0 ctin_1_i ctin_1 function assignment. the value is the pin number to be assigned to this function. the following pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff 15:8 ctin_2_i ctin_2function assignment. the value is the pin number to be assigned to this function. the following pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff 23:16 ctin_3_i ctin_3 function assignment. the value is the pin number to be assigned to this function. the following pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff 31:24 ctout_0_o ctout_0 function assignment. the value is the pin number to be assigned to this function. the following pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 108 of 313 nxp semiconductors um10601 chapter 9: lpc800 switch matrix 9.5.8 pin assign register 7 9.5.9 pin assign register 8 9.5.10 pin enable register 0 table 103. pin assign register 7 (pinassign7, address 0x4000 c01c) bit description bit symbol description reset value 7:0 ctout_1_o ctout_1 function assignment. the value is the pin number to be assigned to this function. the following pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff 15:8 ctout_2_o ctout_2 function assignment. the value is the pin number to be assigned to this function. the following pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff 23:16 ctout_3_o ctout_3 function assignment. the value is the pin number to be assigned to this function. the following pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff 31:24 i2c_sda_io i2c_sda function assignm ent. the value is the pin number to be assigned to this function. the following pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff table 104. pin assign register 8 (pinassign8, address 0x4000 c020) bit description bit symbol description reset value 7:0 i2c_scl_io i2c_scl function assignment. the value is the pin number to be assigned to this function. the following pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff 15:8 acmp_o_o acmp_o_o function assignment. the value is the pin number to be assigned to this function. the following pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff 23:16 clkout_o clkout function assignment. the value is the pin number to be assigned to this function. the following pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff 31:24 gpio_int_bmat_o gpio_int_bmat function assignment. the value is the pin number to be assigned to this function. the following pins are available: pio0_0 (= 0) to pio0_17 (= 0x11). 0xff table 105. pin enable register 0 (pinenable0, address 0x4000 c1c0) bit description bit symbol value description reset value 0 acmp_i1_en enables fixed-pin function. writin g a 1 deselects the function and any movable function can be assigned to this pin. by default the fixed--pin function is deselected and gpio is assigned to this pin. 1 0 enable acmp_i1. this func tion is enabled on pin pio0_0. 1 disable acmp_i1. gpio function pio0_0 (default) or any other movable function can be assigned to pin pio0_0.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 109 of 313 nxp semiconductors um10601 chapter 9: lpc800 switch matrix 1 acmp_i2_en enables fixed-pin function. writin g a 1 deselects the function and any movable function can be assigned to this pin. by de fault the fixed-pin function is deselected and gpio is assigned to this pin. func tions clkin and acmp_i2 are connected to the same pin pio0_1. to use acmp_i2, disa ble the clkin function in bit 7 of this register and enable acmp_i2. 1 0 enable acmp_i2. this func tion is enabled on pin pio0_1. 1 disable acmp_i2. gpio function pio0_1 (default) or any other movable function can be assigned to pin pio0_1. 2 swclk_en enables fixed-pin function. writin g a 1 deselects the function and any movable function can be assigned to this pin. th is function is selected by default. 0 0 enable swclk. this function is enabled on pin pio0_3. 1 disable swclk. gpio function pio0_3 is selected on this pin. any other movable function can be assigned to pin pio0_3. 3 swdio_en enables fixed-pin function. writing a 1 deselects the function and any movable function can be assigned to this pin. th is function is selected by default. 0 0 enable swdio. this function is enabled on pin pio0_2. 1 disable swdio. gpio function pio0_2 is se lected on this pin. any other movable function can be assigned to pin pio0_2. 4 xtalin_en enables fixed-pin function. writin g a 1 deselects the function and any movable function can be assigned to this pin. by default the fixed--pin function is deselected and gpio is assigned to this pin. 1 0 enable xtalin. this function is enabled on pin pio0_8. 1 disable xtalin. gpio function pio0_8 (d efault) or any other movable function can be assigned to pin pio0_8. 5 xtalout_en enables fixed-pin function. writin g a 1 deselects the function and any movable function can be assigned to this pin. by default the fixed--pin function is deselected and gpio is assigned to this pin. 1 0 enable xtalout. this function is enabled on pin pio0_9. 1 disable xtalout. gpio function pio0_9 (default) or any other movable function can be assigned to pin pio0_9. 6 reset_en enables fixed-pin function. writing a 1 deselects the func tion and any movable function can be assigned to this pin. th is function is selected by default. 0 0 enable reset . this function is enabled on pin pio0_5. 1 disable reset . gpio function pio0_5 is selected on this pin. any other movable function can be assigned to pin pio0_5. 7 clkin enables fixed-pin function. writing a 1 deselects the function and any movable function can be assigned to this pin. by de fault the fixed-pin function is deselected and gpio is assigned to this pin. func tions clkin and acmp_i2 are connected to the same pin pio0_1. to use clkin, disabl e acmp_i2 in bit 1 of this register and enable clkin. 1 0 enable clkin. this function is enabled on pin pio0_1. 1 disable clkin. gpio function pio0_1 (defau lt) or any other movable function can be assigned to pin clkin. table 105. pin enable register 0 (pinenable0, address 0x4000 c1c0) bit description bit symbol value description reset value
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 110 of 313 nxp semiconductors um10601 chapter 9: lpc800 switch matrix 8 vddcmp enables fixed-pin function. writing a 1 deselects the function and any movable function can be assigned to this pin. by default the fixed--pin function is deselected and gpio is assigned to this pin. 1 0 enable vddcmp. this function is enabled on pin pio0_6. 1 disable vddcmp. gpio function pio0_6 (d efault) or any other movable function can be assigned to pin pio0_6. 31:9 - reserved. table 105. pin enable register 0 (pinenable0, address 0x4000 c1c0) bit description bit symbol value description reset value
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 111 of 313 10.1 how to read this chapter the sct is available on all lpc800 parts. 10.2 features ? two 16-bit counters or one 32-bit counter. ? counters clocked by bus clock or selected input. ? up counters or up-down counters. ? state variable allows sequencin g across multiple counter cycles. ? the following conditions define an event: a counter match condition, an input (or output) condition, a combination of a matc h and/or and input/output condition in a specified state, and the count direction. ? events control outputs, interr upts, and the sct states. ? match register 0 can be used as an automatic limit. ? in bi-directional mode, events can be enabled based on the count direction. ? match events can be held until another qualifying event occurs. ? selected events can limit, halt, start, or stop a counter. ? supports: ? 4 inputs ? 4 outputs ? 5 match/capture registers ? 6 events ? 2 states 10.3 basic configuration configure the sct as follows: ? use the sysahbclkctrl register ( table 18 ) to enable the clock to the sct register interface and peripheral clock. the lpc800 s ystem clock is the input clock to the sct clock processing and is the source of the sct clock. ? clear the sct peripheral reset us ing the presetctrl register ( ta b l e 7 ). ? the sct combined interrupt is connected to slot #8 in the nvic. ? use the switch matrix to connect the sct inputs and outputs to pins (see section 10.4 ). 10.3.1 use the sct as a simple timer to configure the sct as a simple timer with match or capture functionality, follow these steps: um10601 chapter 10: lpc800 state configurable timer (sct) rev. 1.0 ? 7 november 2012 preliminary user manual
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 112 of 313 nxp semiconductors um10601 chapter 10: lpc800 state configurable timer (sct) 1. set up the sct as one 32-bit timer or one or two 16-bit timers. see table 108 . 2. preload the 32-bit timer or the 16-bit timers with a count value. see table 114 . 3. if you want to cr eate a match event when the timer reaches a match value: a. configure the register map for match registers. see table 117 . b. configure one or more match registers with a match value. see table 125 . c. for each match value, cr eate a match event. see table 130 . d. if you want to create an interrupt on a match event, enable the event for interrupt. see table 122 . e. if you want to create a match output on a pin, connect the ctoutn function to a pin (see section 10.4 ) and select an output for the match event in the evn_ctrl register. see table 130 . the evn_ctrl registers also control what type of output signal is created. 4. if you want to capture a timer value on a capture signal: a. configure the register map for capture registers. see table 117 . b. create one or more capture events. see table 130 . c. connect the ctin functions to pins (see section 10.4 ) and configure the signal to create an event. see table 130 . 5. start the timer by writing to the crtl register. see table 109 . 6. read the capture registers to read the timer value at the time of the capture events. 10.4 pin description the sct inputs and outputs are movable functions and are assigned to external pins through the switch matrix. see section 9.3.1 ? connect an internal signal to a package pin ? to assign the sct functions to pins on the lpc800 package. 10.5 general description the state configurable timer (sct) allows a wide variety of timing, counting, output modulation, and input capture operations. table 106. sct pin description function direction pin description swm register reference ctin_0 i any sct input 0 pinassign5 table 101 ctin_1 i any sct input 1 pinassign6 table 102 ctin_2 i any sct input 2 pinassign6 table 102 ctin_3 i any sct input 3 pinassign6 table 102 ctout_0 o any sct output 0 pinassign6 table 102 ctout_1 o any sct output 1 pinassign7 table 103 ctout_2 o any sct output 2 pinassign7 table 103 ctout_3 o any sct output 3 pinassign7 table 103
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 113 of 313 nxp semiconductors um10601 chapter 10: lpc800 state configurable timer (sct) the most basic user-programmable option is whether a sct operates as two 16-bit counters or a unified 32-bit counter. in the two-counter case, in addition to the counter value the following operational elements are independent for each half: ? state variable ? limit, halt, stop, and start conditions ? values of match/capture registers, plus reload or capture control values in the two-counter case, the following operational elements are global to the sct: ? clock selection ? inputs ? events ? outputs ? interrupts events, outputs, and interrupts can use match conditions from either counter. remark: in this chapter, the term bus error indi cates an sct response that makes the processor take an exception. fig 8. sct block diagram 5)+$!%"+)a$b 
!"#! $d$(+<
!"#!
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 114 of 313 nxp semiconductors um10601 chapter 10: lpc800 state configurable timer (sct) 10.6 register description the register addresses of the stat e configurable timer are shown in table 107 . for most of the sct registers, the register function de pends on the setting of certain other register bits: 1. the unify bit in the config register de termines whether the sct is used as one 32-bit register (for operation as one 32 -bit counter/timer) or as two 16-bit counter/timers named l and h. the setting of the unify bit is reflected in the register map: ? unify = 1: only one register is used (f or operation as one 32-bit counter/timer). ? unify = 0: access the l and h registers by a 32-bit read or write operation or can be read or written to individually (for operation as two 16-bit counter/timers). typically, the unify bit is configured by writing to the config register before any other registers are accessed. 2. the regmoden bits in the regmode register determine whether each set of match/capture registers uses the match or capture functionality: ? regmoden = 1: registers operate as match and reload registers. ? regmoden = 0: registers operate as capture and capture control registers. fig 9. sct counter and select logic 
!"#! $d$(+<
!"#! &696+' !#;&(+) 
!#;&(+) 
!#;&(+) 5)+$!%"+) 5)+$!%"+)
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 115 of 313 nxp semiconductors um10601 chapter 10: lpc800 state configurable timer (sct) table 107. register overview: state configurable timer (base address 0x5000 4000) name access address offset description reset value reference config r/w 0x000 sct configuration register 0x0000 7e00 table 108 ctrl r/w 0x004 sct control register 0x0004 0004 table 109 ctrl_l r/w 0x004 sct control register low counter 16-bit - table 109 ctrl_h r/w 0x006 sct control register high counter 16-bit - table 109 limit r/w 0x008 sct limit register 0x0000 0000 table 110 limit_l r/w 0x008 sct limit register low counter 16-bit - table 110 limit_h r/w 0x00a sct limit register high counter 16-bit - table 110 halt r/w 0x00c sct halt condition register 0x0000 0000 table 111 halt_l r/w 0x00c sct halt condition register low counter 16-bit - table 111 halt_h r/w 0x00e sct halt condition register high counter 16-bit - table 111 stop r/w 0x010 sct stop condition register 0x0000 0000 table 112 stop_l r/w 0x010 sct stop conditi on register low counter 16-bit - table 112 stop_h r/w 0x012 sct stop condition register high counter 16-bit - table 112 start r/w 0x014 sct start condition register 0x0000 0000 table 113 start_l r/w 0x014 sct start condition register low counter 16-bit - table 113 start_h r/w 0x016 sct start condition register high counter 16-bit - table 113 - - 0x018 - 0x03c reserved - count r/w 0x040 sct counter register 0x0000 0000 table 114 count_l r/w 0x040 sct counter register low counter 16-bit - table 114 count_h r/w 0x042 sct counter register high counter 16-bit - table 114 state r/w 0x044 sct state register 0x0000 0000 table 115 state_l r/w 0x044 sct state register low counter 16-bit - table 115 state_h r/w 0x046 sct state register high counter 16-bit - table 115 input ro 0x048 sct input register 0x0000 0000 table 116 regmode r/w 0x04c sct match/capture r egisters mode register 0x0000 0000 table 117 regmode_l r/w 0x04c sct match/captur e registers mode register low counter 16-bit - table 117 regmode_h r/w 0x04e sct match/captur e registers mode register high counter 16-bit - table 117 output r/w 0x050 sct output register 0x0000 0000 table 118 outputdirctrl r/w 0x054 sct output counter direction control register 0x0000 0000 table 119 res r/w 0x058 sct conflict resolution register 0x0000 0000 table 120 - - 0x05c - - - - - 0x060 - - - - - 0x064 - 0x0ec reserved - - even r/w 0x0f0 sct event enable register 0x0000 0000 table 121 evflag r/w 0x0f4 sct event flag register 0x0000 0000 table 122 conen r/w 0x0f8 sct conflict enable register 0x0000 0000 table 123 conflag r/w 0x0fc sct conflict flag register 0x0000 0000 table 124
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 116 of 313 nxp semiconductors um10601 chapter 10: lpc800 state configurable timer (sct) match0 to match4 r/w 0x100 to 0x110 sct match value register of match channels 0 to 4; regmod0 to regmode4 = 0 0x0000 0000 table 124 match_l0 to match_l4 r/w 0x100 to 0x110 sct match value register of match channels 0 to 4; low counter 16-bit; regmod0_l to regmode4_l = 0 - table 124 match_h0 to match_h4 r/w 0x102 to 0x112 sct match value register of match channels 0 to 4; high counter 16-bit; regmod0_h to regmode4_h = 0 - table 124 cap0 to cap4 0x100 to 0x110 sct capture register of capture channel 0 to 4; regmod0 to regmode4 = 1 0x0000 0000 table 126 cap_l0 to cap_l4 0x100 to 0x110 sct capture register of capture channel 0 to 4; low counter 16-bit; regmod0_l to regmode4_l = 1 - table 126 cap_h0 to cap_h4 0x102 to 0x13e sct capture register of capture channel 0 to 4; high counter 16-bit; regmod0_h to regmode4_h = 1 - table 126 matchrel0 to matchrel4 r/w 0x200 to 0x210 sct match reload value register 0 to 4 regmod0 = 0 to regmode4 = 0 0x0000 0000 table 127 matchrel_l0 to matchrel_l4 r/w 0x200 to 0x210 sct match reload value register 0 to 4; low counter 16-bit; regmod0_l = 0 to regmode4_l = 0 - table 127 matchrel_h0 to matchrel_h4 r/w 0x202 to 0x212 sct match reload value register 0 to 4; high counter 16-bit; regmod0_h = 0 to regmode4_h = 0 - table 127 capctrl0 to capctrl4 0x200 to 0x210 sct capture control register 0 to 4; regmod0 = 1 to regmode4 = 1 0x0000 0000 table 128 capctrl_l0 to capctrl_l4 0x200 to 0x210 sct capture control register 0 to 4; low counter 16-bit; regmod0_l = 1 to regmode4_l = 1 - table 128 capctrl_h0 to capctrl_h4 0x202 to 0x212 sct capture control register 0 to 4; high counter 16-bit; regmod0 = 1 to regmode4 = 1 - table 128 ev0_state r/w 0x300 sct event 0 state register 0x0000 0000 table 129 ev0_ctrl r/w 0x304 sct event 0 control register 0x0000 0000 table 130 ev1_state r/w 0x308 sct event 1 state register 0x0000 0000 table 129 ev1_ctrl r/w 0x30c sct event 1 control register 0x0000 0000 table 130 ev2_state r/w 0x310 sct event 2 state register 0x0000 0000 table 129 ev2_ctrl r/w 0x314 sct event 2 control register 0x0000 0000 table 130 ev3_state r/w 0x318 sct event 3 state register 0x0000 0000 table 129 ev3_ctrl r/w 0x31c sct event 3 control register 0x0000 0000 table 130 ev4_state r/w 0x320 sct event 4 state register 0x0000 0000 table 129 ev4_ctrl r/w 0x324 sct event 4 control register 0x0000 0000 table 130 ev5_state r/w 0x328 sct event 5 state register 0x0000 0000 table 129 ev5_ctrl r/w 0x32c sct event 5 control register 0x0000 0000 table 130 out0_set r/w 0x500 sct output 0 set register 0x0000 0000 table 131 out0_clr r/w 0x504 sct output 0 clear register 0x0000 0000 table 132 out1_set r/w 0x508 sct output 1 set register 0x0000 0000 table 131 table 107. register overview: state configurable timer (base address 0x5000 4000) ?continued name access address offset description reset value reference
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 117 of 313 nxp semiconductors um10601 chapter 10: lpc800 state configurable timer (sct) 10.6.1 sct configuration register this register configures the ov erall operation of the sct. write to this register before any other registers. out1_clr r/w 0x50c sct output 1 clear register 0x0000 0000 table 132 out2_set r/w 0x510 sct output 2 set register 0x0000 0000 table 131 out2_clr r/w 0x514 sct output 2 clear register 0x0000 0000 table 132 out3_set r/w 0x518 sct output 3 set register 0x0000 0000 table 131 out3_clr r/w 0x51c sct output 3 clear register 0x0000 0000 table 132 table 107. register overview: state configurable timer (base address 0x5000 4000) ?continued name access address offset description reset value reference table 108. sct configuration register (con fig, address 0x5000 4000) bit description bit symbol value description reset value 0 unify sct operation 0 0 the sct operates as two 16-bit counters named l and h. 1 the sct operates as a unified 32-bit counter. 2:1 clkmode sct clock mode 0 0x0 the bus clock clocks the sct and prescalers. 0x1 the sct clock is the bus clock, but the prescalers are enabled to count only when sampling of the input selected by the cksel field finds the selected edge. the minimum pulse width on the clock input is 1 bus clock period. this mode is the high-performance sampled-clock mode. 0x2 the input selected by cksel clocks the sct and prescalers. the input is synchronized to the bus cl ock and possibly inverted. the minimum pulse width on the clock input is 1 bus clock period. this mode is the low-power sampled-clock mode. 0x3 reserved. 6:3 cksel sct clock select. all other values are reserved. 0 0x0 rising edges on input 0. 0x1 falling edges on input 0. 0x2 rising edges on input 1. 0x3 falling edges on input 1. 0x4 rising edges on input 2. 0x5 falling edges on input 2. 0x6 rising edges on input 3. 0x7 falling edges on input 3. 7 norelaod_l - a 1 in this bit prevents the lower match registers from being reloaded from their respective reload registers. software can write to set or clear this bit at any time. this bit applies to both the higher and lower registers when the unify bit is set. 0 8 noreload_h - a 1 in this bit prevents the higher match registers from being reloaded from their respective reload registers. software can write to set or clear this bit at any time. this bit is not used when the unify bit is set. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 118 of 313 nxp semiconductors um10601 chapter 10: lpc800 state configurable timer (sct) 10.6.2 sct control register if unify = 1 in the config register, only the _l bits are used. if unify = 0 in the config regi ster, this register can be written to as two registers ctrl_l and ctrl_h. both the l and h registers can be read or written individually or in a single 32-bit read or write operation. all bits in this register can be written to w hen the counter is stopped or halted. when the counter is running, the only bits that can be written are stop or halt. (other bits can be written in a subsequent write after halt is set to 1.) 16:9 insync - synchronization for input n (bit 9 = input 0, bit 10 = input 1,..., bit 16 = input 7). a 1 in one of these bits subjects the corresponding input to synchronization to the sct clock, before it is used to create an event. if an input is synchronous to the sct clock, keep its bit 0 for faster response. when the ckmode field is 1x, the bit in this field, corresponding to the input selected by the cksel field, is not used. 1 17 autolimit_l - a one in this bit causes a match on match register 0 to be treated as a de-facto limit condition without the need to define an associated event. as with any limit event, this automatic li mit causes the counter to be cleared to zero in uni-directional mode or to change the direction of count in bi-directional mode. software can write to set or clear this bit at any time. this bit applies to both the higher and lower registers when the unify bit is set. 18 autolimit_h - a one in this bit will cause a ma tch on match register 0 to be treated as a de-facto limit condition wi thout the need to define an associated event. as with any limit event, this automatic li mit causes the counter to be cleared to zero in uni-directional mode or to change the direction of count in bi-directional mode. software can write to set or clear this bit at any time. this bit is not used when the unify bit is set. 31:19 - reserved - table 108. sct configuration register (con fig, address 0x5000 4000) bit description ?continued bit symbol value description reset value table 109. sct control register (ctrl, address 0x5000 4004) bit description bit symbol value description reset value 0 down_l - this bit is 1 when the l or unified counter is counting down. hardware sets this bit when the counter limit is reached and bidir is 1. hardware clears this bit when the counter is counting down and a limit condition occurs or when the counter reaches 0. 0 1 stop_l - when this bit is 1 and halt is 0, the l or unified counter does not run, but i/o events related to the counter can o ccur. if such an event matches the mask in the start register, this bit is cleared and counting resumes. 0 2 halt_l - when this bit is 1, the l or unified counter does not run and no events can occur. a reset sets this bit. when the halt_l bit is one, the stop_l bit is cleared. if you want to remove the halt condition and keep the sct in the stop condition (not running), then you can change the halt an d stop condition with one single write to this register. remark: once set, only software can clear this bit to restore counter operation. 1
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 119 of 313 nxp semiconductors um10601 chapter 10: lpc800 state configurable timer (sct) 10.6.3 sct limit register if unify = 1 in the config register, only the _l bits are used. if unify = 0 in the config regi ster, this register can be written to as two registers limit_l and limit_h. both the l and h registers can be read or written individually or in a single 32-bit read or write operation. the bits in this register set which events ac t as counter limits. when a limit event occurs, the counter is cleared to zero in unidirectional mode or changes the direction of count in bidirectional mode. when the counter reaches a ll ones, this state is always treated as a limit event, and the counter is cleared in un idirectional mode or, in bidirectional mode, begins counting down on the next clock edge - even if no limit even t as defined by the sct limit register has occurred. 3 clrctr_l - writing a 1 to this bit clears the l or unified counter. this bit always reads as 0. 0 4 bidir_l l or unified counter direction select 0 0 the counter counts up to its limit condition, then is cleared to zero. 1 the counter counts up to its limit, then counts down to a limit condition or to 0. 12:5 pre_l - specifies the factor by which the sct clock is prescaled to produce the l or unified counter clock. the counter clock is clocked at the rate of the sct clock divided by pre_l+1. remark: clear the counter (by writing a 1 to the clrctr bit) whenever changing the pre value. 0 15:13 - reserved 16 down_h - this bit is 1 when the h counter is co unting down. hardware sets this bit when the counter limit is reached and bidir is 1. hardware clears this bit when the counter is counting down and a limit condition occurs or when the counter reaches 0. 0 17 stop_h - when this bit is 1 and halt is 0, th e h counter does not, run but i/o events related to the counter can occur. if such an event matches the mask in the start register, this bit is cleared and counting resumes. 0 18 halt_h - when this bit is 1, the h counter does not run and no events can occur. a reset sets this bit. when the halt_h bit is one, the stop_h bit is cleared. if you want to remove the halt condition and keep the sct in the stop condition (not running), then you can change the halt and stop condition with one single write to this register. remark: once set, this bit can only be cleared by software to restore counter operation. 1 19 clrctr_h - writing a 1 to this bit clears the h counter. this bit always reads as 0. 0 20 bidir_h direction select 0 0 the h counter counts up to its limit condition, then is cleared to zero. 1 the h counter counts up to its limit, then counts down to a limit condition or to 0. 28:21 pre_h - specifies the factor by which the sc t clock is prescaled to produce the h counter clock. the counter clock is clocked at the rate of the sct clock divided by prelh+1. remark: clear the counter (by writing a 1 to the clrctr bit) whenever changing the pre value. 0 31:29 - reserved table 109. sct control register (ctrl, address 0x5000 4004) bit description bit symbol value description reset value
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 120 of 313 nxp semiconductors um10601 chapter 10: lpc800 state configurable timer (sct) note that in addition to using this register to specify events that serve as limits, it is also possible to automatically cause a limit condition whenever a match register 0 match occurs. this eliminates the need to define an ev ent for the sole purpose of creating a limit. the autolimitl and autolimith bits in the configuration register enable/disable this feature (see table 108 ). 10.6.4 sct halt condition register if unify = 1 in the config register, only the _l bits are used. if unify = 0 in the config regi ster, this register can be written to as two registers halt_l and halt_h. both the l and h registers can be read or written individually or in a single 32-bit read or write operation. remark: any event halting the counter disables it s operation until software clears the halt bit (or bits) in the ctrl register ( ta b l e 1 0 9 ). 10.6.5 sct stop condition register if unify = 1 in the config register, only the _l bits are used. if unify = 0 in the config regi ster, this register can be written to as two registers stopt_l and stop_h. both the l and h registers can be read or written individually or in a single 32-bit read or write operation. table 110. sct limit register (limit, address 0x5000 4008) bit description bit symbol description reset value 5:0 limmsk_l if bit n is one, event n is used as a counter limit for the l or unified counter (event 0 = bit 0, event 1 = bit 1, event 5 = bit 5). 0 15:6 - reserved. - 20:16 limmsk_h if bit n is one, event n is used as a counter limit for the h counter (event 0 = bit 16, even t 1 = bit 17, event 5 = bit 20). 0 31:21 - reserved. - table 111. sct halt condition register (halt, address 0x5004 400c) bit description bit symbol description reset value 5:0 haltmsk_l if bit n is one, event n sets the halt_l bit in the ctrl register (event 0 = bit 0, event 1 = bit 1, event 5 = bit 5). 0 15:6 - reserved. - 20:16 haltmsk_h if bit n is one, event n sets the halt_h bit in the ctrl register (event 0 = bit 16, event 1 = bit 17, event 5 = bit 20). 0 31:21 - reserved. -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 121 of 313 nxp semiconductors um10601 chapter 10: lpc800 state configurable timer (sct) 10.6.6 sct start condition register if unify = 1 in the config register, only the _l bits are used. if unify = 0 in the config regi ster, this register can be written to as two registers start_l and start_h. both the l and h registers can be read or written individually or in a single 32-bit read or write operation. the bits in this register select which events , if any, clear the stop bit in the control register. (since no events can occur when halt is 1, only software can clear the halt bit by writing the control register.) 10.6.7 sct counter register if unify = 1 in the config register, the counter is a unified 32-bit register and both the _l and _h bits are used. if unify = 0 in the config regi ster, this register can be written to as two registers count_l and count_h. both the l and h regist ers can be read or written individually or in a single 32-bit read or write operation. in this case, the l and h registers count independently under the control of the other registers. attempting to write a counter wh ile it is running does not affect the counter but produces a bus error. software can read the counter registers at any time. table 112. sct stop condition register (s top, address 0x5000 4010) bit description bit symbol description reset value 5:0 stopmsk_l if bit n is one, event n sets the stop_l bit in the ctrl register (event 0 = bit 0, event 1 = bit 1, event 5 = bit 5). 0 15:6 - reserved. - 20:16 stopmsk_h if bit n is one, event n sets the stop_h bit in the ctrl register (event 0 = bit 16, event 1 = bit 17, event 5 = bit 20). 0 31:21 - reserved. - table 113. sct start condition register (sta rt, address 0x5000 4014) bit description bit symbol description reset value 5:0 startmsk_l if bit n is one, event n clears the stop_l bit in the ctrl register (event 0 = bit 0, event 1 = bit 1, event 5 = bit 5). 0 15:6 - reserved. - 20:16 startmsk_h if bit n is one, event n clears the stop_h bit in the ctrl register (event 0 = bit 16, event 1 = bit 17, event 5 = bit 20). 0 31:21 - reserved. -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 122 of 313 nxp semiconductors um10601 chapter 10: lpc800 state configurable timer (sct) 10.6.8 sct state register if unify = 1 in the config register, only the _l bits are used. if unify = 0 in the config regi ster, this register can be written to as two registers state_l and state_h. both the l and h register s can be read or written individually or in a single 32-bit read or write operation. software can read the state associated with a counter at any time. writing the state is only allowed when the counter halt bit is 1; when halt is 0, a write attempt does not change the state and results in a bus error. the state variable is the main feature that di stinguishes the sct from other counter/timer/ pwm blocks. events can be made to occur onl y in certain states. events, in turn, can perform the following actions: ? set and clear outputs ? limit, stop, and start the counter ? cause interrupts ? modify the state variable the value of a state variable is completely under the control of the application. if an application does not use states, the value of the state variable remains zero, which is the default value. a state variable can be used to track and cont rol multiple cycles of the associated counter in any desired operational sequence. the state variable is logically associated with a state machine diagram which represents the sct configuration. see section 10.6.22 and 10.6.23 for more about the relationship between states and events. the stateld/stadev fields in the event control registers of all defined events set all possible values for the state variable. the change of the state variable during multiple counter cycles reflects how the associated state machine moves from one state to the next. table 114. sct counter register (count , address 0x5000 4040) bit description bit symbol description reset value 15:0 ctr_l when unify = 0, read or writ e the 16-bit l counter value. when unify = 1, read or writ e the lower 16 bits of the 32-bit unified counter. 0 31:16 ctr_h when unify = 0, read or writ e the 16-bit h counter value. when unify = 1, read or write the uppe r 16 bits of the 32-bit unified counter. 0 table 115. sct state register (state, address 0x5000 4044) bit description bit symbol description reset value 4:0 state_l state variable. 0 15:5 - reserved. - 20:16 state_h state variable. 0 31:21 - reserved.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 123 of 313 nxp semiconductors um10601 chapter 10: lpc800 state configurable timer (sct) 10.6.9 sct input register software can read the state of the sct inputs in this read-only register in two slightly different forms. the only situation in which t hese values are different is if clkmode = 2 in the config register. 10.6.10 sct match/capture registers mode register if unify = 1 in the config regist er, only the _l bits of this register are used. the l bits control whether each set of match/capture registers op erates as unified 32-bit capture/match registers. if unify = 0 in the config regi ster, this register can be written to as two registers regmode_l and regmode_h. both the l and h registers can be read or written individually or in a single 32-bit read or writ e operation.the _l bits/registers control the l match/capture registers, and the _h bits/reg isters control the h match/capture registers. the sct contains 5 match/capture register pairs. the register mode register selects whether each register pair acts as a match register (see section 10.6.18 ) or as a capture register (see section 10.6.19 ). each match/capture regi ster has an accompanying register which serves as a reload register wh en the register is used as a match register ( section 10.6.20 ) or as a capture-control register when the register is used as a capture register ( section 10.6.21 ). regmode_h is used only when the unify bit is 0. table 116. sct input register (input, address 0x5000 4048) bit description bit symbol description reset value 0 ain0 real-time status of input 0. pin 1 ain1 real-time status of input 1. pin 2 ain2 real-time status of input 2. pin 3 ain3 real-time status of input 3. pin 15:4 - reserved. - 16 sin0 input 0 state synchronized to the sct clock. - 17 sin1 input 1 state synchronized to the sct clock. - 18 sin2 input 2 state synchronized to the sct clock. - 19 sin3 input 3 state synchronized to the sct clock. - 31:20 - reserved -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 124 of 313 nxp semiconductors um10601 chapter 10: lpc800 state configurable timer (sct) 10.6.11 sct output register the sct supports 4 outputs, each of which has a corresponding bit in this register. software can write to any of the output registers when both counters are halted to control the outputs directly. writing to this register when either counter is stopped or running does not affect the outputs and results in an bus error. software can read this register at any time to sense the state of the outputs. 10.6.12 sct bidirectional output control register this register specifies (for each output) the impact of the counting direction on the meaning of set and clear oper ations on the output (see section 10.6.24 and section 10.6.25 ). table 117. sct match/capture registers mode register (regmode, address 0x5000 404c) bit description bit symbol description reset value 4:0 regmod_l each bit controls one pair of match/capture regi sters (register 0 = bit 0, register 1 = bit 1,..., register 4 = bit 4). 0 = registers operate as match registers. 1 = registers operate as capture registers. 0 15:5 - reserved. - 19:16 regmod_h each bit controls one pair of match/capture regi sters (register 0 = bit 16, register 1 = bit 17,..., register 4 = bit 19). 0 = registers operate as match registers. 1 = registers operate as capture registers. 0 31:20 - reserved. - table 118. sct output register (output, address 0x5000 4050) bit description bit symbol description reset value 3:0 out writing a 1 to bit n makes the corresponding output high. 0 makes the corresponding output low (output 0 = bit 0, output 1 = bit 1,..., output 3 = bit 3). 0 31:4 - reserved table 119. sct bidirectional output control register (outputdirctrl, address 0x5000 4054) bit description bit symbol value description reset value 1:0 setclr0 set/clear operation on output 0. value 0x3 is reserved. do not program this value. 0 0x0 set and clear do not depend on any counter. 0x1 set and clear are reversed when counte r l or the unified counter is counting down. 0x2 set and clear are reversed when counter h is counting down. do not use if unify = 1. 3:2 setclr1 set/clear operation on output 1. value 0x3 is reserved. do not program this value. 0 0x0 set and clear do not depend on any counter. 0x1 set and clear are reversed when counte r l or the unified counter is counting down. 0x2 set and clear are reversed when counter h is counting down. do not use if unify = 1.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 125 of 313 nxp semiconductors um10601 chapter 10: lpc800 state configurable timer (sct) 10.6.13 sct conflict resolution register the registers outn_setn ( section 10.6.24 ) and outnclrn ( section 10.6.25 ) allow both setting and clearing to be indicated for an output in the same clock cycle, even for the same event. this sct conflict resoluti on register resolves this conflict. to enable an event to toggle an output, set the onres value to 0x3 in this register, and set the event bits in both the set and clear registers. 5:4 setclr2 set/clear operation on output 2. value 0x3 is reserved. do not program this value. 0 0x0 set and clear do not depend on any counter. 0x1 set and clear are reversed when counte r l or the unified counter is counting down. 0x2 set and clear are reversed when counter h is counting down. do not use if unify = 1. 7:6 setclr3 set/clear operation on output 3. value 0x3 is reserved. do not program this value. 0 0x0 set and clear do not depend on any counter. 0x1 set and clear are reversed when counte r l or the unified counter is counting down. 0x2 set and clear are reversed when counter h is counting down. do not use if unify = 1. 31:8 - reserved - table 119. sct bidirectional output control register (outputdirctrl, address 0x5000 4054) bit description bit symbol value description reset value table 120. sct conflict resolution register (res, address 0x5000 4058) bit description bit symbol value description reset value 1:0 o0res effect of simultaneous set and clear on output 0. 0 0x0 no change. 0x1 set output (or clear based on the setclr0 field). 0x2 clear output (or set based on the setclr0 field). 0x3 toggle output. 3:2 o1res effect of simultaneous set and clear on output 1. 0 0x0 no change. 0x1 set output (or clear based on the setclr1 field). 0x2 clear output (or set based on the setclr1 field). 0x3 toggle output. 5:4 o2res effect of simultaneous set and clear on output 2. 0 0x0 no change. 0x1 set output (or clear based on the setclr2 field). 0x2 clear output n (or set based on the setclr2 field). 0x3 toggle output. 7:6 o3res effect of simultaneous set and clear on output 3. 0 0x0 no change. 0x1 set output (or clear based on the setclr3 field). 0x2 clear output (or set based on the setclr3 field). 0x3 toggle output. 31:8 - - reserved -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 126 of 313 nxp semiconductors um10601 chapter 10: lpc800 state configurable timer (sct) 10.6.14 sct flag enable register this register enables flags to request an inte rrupt if the flagn bit in the sct event flag register ( section 10.6.15 ) is also set. 10.6.15 sct event flag register this register records events. writing ones to this register clears the corresponding flags and negates the sct interrupt request if all enabled flag bits are zero. 10.6.16 sct conflict enable register this register enables the ?no change conflict? events specified in the sct conflict resolution register to request an irq. 10.6.17 sct conflict flag register this register records interrupt-enabled no-change conflict events and provides details of a bus error. writing ones to the ncflag bits clears the corresponding read bits and negates the sct interrupt request if all enabled flag bits are zero. table 121. sct flag enable register (even, address 0 x5000 40f0) bit description bit symbol description reset value 5:0 ien the sct requests an interrupt when bit n of this register and the event flag register are both one (event 0 = bit 0, event 1 = bit 1,..., event 5 = bit 5). 0 31:6 - reserved table 122. sct event flag register (evflag, address 0x5000 40f4) bit description bit symbol description reset value 5:0 flag bit n is one if event n has occurre d since reset or a 1 was last written to this bit (event 0 = bit 0, event 1 = bit 1,..., event 5 = bit 5). 0 31:6 - reserved - table 123. sct conflict enable register (conen, address 0x5000 40f8) bit description bit symbol description reset value 3:0 ncen the sct requests interrupt when bit n of this register and the sct conflict flag register are both one (output 0 = bit 0, output 1 = bit 1,..., output 3 = bit 3). 0 31:4 - reserved
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 127 of 313 nxp semiconductors um10601 chapter 10: lpc800 state configurable timer (sct) 10.6.18 sct match registers 0 to 4 (regmoden bit = 0) match registers are compared to the counters to help create events. when the unify bit is 0, the l and h registers are independent ly compared to the l and h counters. when unify is 1, the l and h registers hold a 32-bit value that is compared to the unified counter. a match can only occur in a clock in which the counter is running (stop and halt are both 0). match registers can be read at any time. writ ing to a match register while the associated counter is running does not affect the match register and results in a bus error. match events occur in the sct clock in which the counter is (or would be) incremented to the next value. when a match event limits its counter as described in section 10.6.3 , the value in the match register is the last value of the counter before it is cleared to zero (or decremented if bidir is 1). there is no ?write-through? from reload registers to match registers. before starting a counter, software can write one value to the match register used in the first cycle of the counter and a different value to the corresponding match reload register used in the second cycle. 10.6.19 sct capture register s 0 to 4 (reg moden bit = 1) these registers allow software to read the c ounter values at which the event selected by the corresponding capture control registers occurred. table 124. sct conflict flag register (con flag, address 0x5000 40fc) bit description bit symbol description reset value 3:0 ncflag bit n is one if a no-chang e conflict event occurred on output n since reset or a 1 was last written to this bit (output 0 = bit 0, output 1 = bit 1,..., output 3 = bit 3). 0 29:4 - reserved. - 30 buserrl the most recent bus error from this sct involved writing ctr l/unified, state l/unified, ma tch l/unified, or the output register when the l/u counter was not halted. a word write to certain l and h registers can be half successful and half unsuccessful. 0 31 buserrh the most recent bus error from this sct involved writing ctr h, state h, match h, or the output register when the h counter was not halted. 0 table 125. sct match registers 0 to 4 (match[0:4], address 0x5000 4100 (match0) to 0x5000 4110 (match4)) bit description (regmoden bit = 0) bit symbol description reset value 15:0 valmatch_l when unify = 0, read or write the 16-bit value to be compared to the l counter. when unify = 1, read or write the lower 16 bits of the 32-bit value to be compared to the unified counter. 0 31:16 valmatch_h when unify = 0, read or write the 16-bit value to be compared to the h counter. when unify = 1, read or write the upper 16 bits of the 32-bit value to be compared to the unified counter. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 128 of 313 nxp semiconductors um10601 chapter 10: lpc800 state configurable timer (sct) 10.6.20 sct match reload regist ers 0 to 4 (regmoden bit = 0) a match register (l, h, or unified 32-bit) is loaded from the corresponding reload register when bidir is 0 and the counter reaches its lim it condition, or when bidir is 1 and the counter reaches 0. 10.6.21 sct capture control regi sters 0 to 4 (r egmoden bit = 1) if unify = 1 in the config register, only the _l bits are used. if unify = 0 in the config regi ster, this register can be written to as two registers capctrln_l and capctrln_h. both the l an d h registers can be read or written individually or in a single 32-bit read or write operation. each capture control register (l, h, or unified 32-bit) controls which events load the corresponding capture register from the counter. table 126. sct capture registers 0 to 4 (cap [0:4], address 0x5000 4100 (cap0) to 0x5000 4110 (cap4)) bit descrip tion (regmoden bit = 1) bit symbol description reset value 15:0 valcap_l when unify = 0, read the 16-bit counter value at which this register was last captured. when unify = 1, read the lower 16 bits of the 32-bit value at which this register was last captured. 0 31:16 valcap_h when unify = 0, read the 16-bit counter value at which this register was last captured. when unify = 1, read the upper 16 bits of the 32-bit value at which this register was last captured. 0 table 127. sct match reload registers 0 to 4 (matchrel[0:4], address 0x5000 4200 (matchrel0) to 0x5000 4210 (matchrel4) bit description (regmoden bit = 0) bit symbol description reset value 15:0 reload_l when unify = 0, read or write the 16-bit value to be loaded into the sctmatchn_l register. when unify = 1, read or write the lower 16 bits of the 32-bit value to be loaded into the matchn register. 0 31:16 reload_h when unify = 0, read or write the 16-bit to be loaded into the matchn_h register. when unify = 1, read or write the upper 16 bits of the 32-bit value to be loaded into the matchn register. 0 table 128. sct capture control registers 0 to 4 (capctrl[0:4], address 0x5000 4200 (capctrl0) to 0x5000 4210 (capctrl4)) bit description (regmoden bit = 1) bit symbol description reset value 5:0 capconm_l if bit m is one, event m c auses the capn_l (unify = 0) or the capn (unify = 1) register to be loaded (event 0 = bit 0, event 1 = bit 1,..., event 5 = bit 5). 0 15:6 - reserved. - 20:16 capconm_h if bit m is one, event m causes the capn_h (unify = 0) register to be loaded (event 0 = bit 16, event 1 = bit 17,..., event 5 = bit 20). 0 31:17 - reserved. -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 129 of 313 nxp semiconductors um10601 chapter 10: lpc800 state configurable timer (sct) 10.6.22 sct event state mask registers 0 to 5 each event has one associated sct event state mask register that allow this event to happen in one or more stat es of the counter selected by the hevent bit in the corresponding evn_ctrl register. an event n is disabled when its evn_state regi ster contains all zeros, since it is masked regardless of the current state. in simple applications that do no t use states, write 0x01 to this register to enable an event. since the state always remains at its reset value of 0, writing 0x01 permanently state-enables this event. 10.6.23 sct event cont rol registers 0 to 5 this register defines the conditions for event n to occur, other than the state variable which is defined by the state mask register. most events are associated with a particular counter (high, low, or unified), in which ca se the event can depend on a match to that register. the other possible ingredient of an event is a selected input or output signal. when the unify bit is 0, each event is a ssociated with a particular counter by the hevent bit in its event control register. an ev ent cannot occur when it s related counter is halted nor when the current state is not enab led to cause the event as specified in its event mask register. an event is permanently disabled when its event state mask register contains all 0s. an enabled event can be programmed to occur based on a selected input or output edge or level and/or based on its counter value ma tching a selected match register (stop bit = 0). an event can be enabled by the event counter?s halt bit and state register. in bi-directional mode, events can also be enabled based on the direction of count. each event can modify its counter state value. if more than one event associated with the same counter occurs in a given clock cycl e, only the state change specified for the highest-numbered event among them takes place. other actions dictated by any simultaneously occurring events all take place. table 129. sct event state mask registers 0 to 5 (ev[0:5]_state, addresses 0x5000 4300 (ev0_state) to 0x5000 4328 (ev5_state)) bit description bit symbol description reset value 1:0 statemskm if bit m is one, event n (n = 0 to 5) happens in state m of the counter selected by the hevent bit (m = state number; state 0 = bit 0, state 1= bit 1). 0 31:2 - reserved. - table 130. sct event control register 0 to 5 (ev[0:5]_ctrl, address 0x5000 4304 (ev0_ctrl) to 0x5000 432c (ev5_ctrl)) bit description bit symbol value description reset value 3:0 matchsel - selects the match register associated with this event (if any). a match can occur only when the counter selected by the hevent bit is running. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 130 of 313 nxp semiconductors um10601 chapter 10: lpc800 state configurable timer (sct) 4 hevent select l/h counter. do not set this bit if unify = 1. 0 0 selects the l state and the l matc h register selected by matchsel. 1 selects the h state and the h matc h register selected by matchsel. 5 outsel input/output select 0 0 selects the inputs elected by iosel. 1 selects the outputs selected by iosel. 9:6 iosel - selects the input or output signal associat ed with this event (if any). do not select an input in this register, if ck mode is 1x. in this case the clock input is an implicit ingredient of every event. bit 6 = 1: ctin1/ctout0 selected. bit 7 = 1: ctin1/ctou1 selected. bit 8 = 1: ctin2/ctout2 selected. bit 9 = 1: ctin3/ctout3 selected. 0 11:10 iocond selects the i/o condition for event n. (the detection of edges on outputs lag the conditions that switch the outputs by one sct clock). in order to guarantee proper edge/state detection, an input must have a minimum pulse width of at least one sct clock period . 0 0x0 low 0x1 rise 0x2 fall 0x3 high 13:12 combmode selects how the specified matc h and i/o condition are used and combined. 0x0 or. the event occurs when either the specified match or i/o condition occurs. 0x1 match. uses the specified match only. 0x2 io. uses the specified i/o condition only. 0x3 and. the event occurs when the specified match and i/o condition occur simultaneously. 14 stateld this bit controls how the statev value modifies the state selected by hevent when this event is the highest-numbered event occurring for that state. 0 statev value is added into state (the carry-out is ignored). 1 statev value is loaded into state. 19:15 statev this value is loaded into or added to the state selected by hevent, depending on stateld, when this event is the highest-num bered event occurring for that state. if stateld and statev are both zero, there is no change to the state value. 20 matchmem if this bit is one and the combmo de field specifies a match component to the triggering of this event, then a match is cons idered to be active whenever the counter value is greater than or equal to the value specified in the match register when counting up, less then or equal to the match value when counting down. if this bit is zero, a match is only be ac tive during the cycle when the counter is equal to the match value. table 130. sct event control register 0 to 5 (ev[0:5]_ctrl, address 0x5000 4304 (ev0_ctrl) to 0x5000 432c (ev5_ctrl)) bit description bit symbol value description reset value
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 131 of 313 nxp semiconductors um10601 chapter 10: lpc800 state configurable timer (sct) 10.6.24 sct output se t registers 0 to 3 each output n has one set register that cont rols how events affect each output. whether outputs are set or cleared depends on the setting of the setclrn field in the sctoutputdirctrl register. 10.6.25 sct output clear registers 0 to 3 each output n has one clear regi ster that controls how events affect each output. whether outputs are set or cleared depends on the setting of the setclrn field in the outputdirctrl register. 22:21 direction direction qualifier for event generation. this field only applies when the counters are operating in bidir mode. if bidir = 0, the sct ignores this field. value 0x3 is reserved. 0x0 direction independent. this event is tr iggered regardless of the count direction. 0x1 counting up. this event is triggered only during up-counting when bidir = 1. 0x2 counting down. this event is triggered only during down-counting when bidir = 1. 31:23 - reserved table 130. sct event control register 0 to 5 (ev[0:5]_ctrl, address 0x5000 4304 (ev0_ctrl) to 0x5000 432c (ev5_ctrl)) bit description bit symbol value description reset value table 131. sct output set register (out[0:3]_set, address 0x5000 4500 (out0_set) to 0x5000 4518 (out3_set)) bit description bit symbol description reset value 5:0 set a 1 in bit m selects event m to se t output n (or clear it if setclrn = 0x1 or 0x2) event 0 = bit 0, event 1 = bit 1,..., event 5 = bit 5. 0 31:6 - reserved table 132. sct output clear register (out[0 :3]_clr, address 0x5000 0504 (out0_clr) to 0x5000 051c (out3_clr)) bit description bit symbol description reset value 5:0 clr a 1 in bit m selects event m to clear output n (or set it if setclrn = 0x1 or 0x2) event 0 = bit 0, event 1 = bit 1,..., event 5 = bit 5. 0 31:6 - reserved
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 132 of 313 nxp semiconductors um10601 chapter 10: lpc800 state configurable timer (sct) 10.7 functional description 10.7.1 match logic 10.7.2 capture logic 10.7.3 event selection state variables allow control of the sct ac ross more than one cycle of the counter. counter matches, input/output edges, and state values are combined into a set of general-purpose events that can switch ou tputs, request interrupts, and change state values. fig 10. match logic i #;&(+)
 #;&(+)
 %(!7
6
 %(!7 +=
6
 %(!7 +"#%'
6
 i %(!7 +=
6
 %(!7 +"#%'
6
 %(!7
6
  fig 11. capture logic

!"#!
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 133 of 313 nxp semiconductors um10601 chapter 10: lpc800 state configurable timer (sct) 10.7.4 output generation figure 13 shows one output slice of the sct. 10.7.5 interrupt generation the sct generates one interrupt to the nvic. fig 12. event selection $+"+!( +*+&(
j6k $+"+!(  6 6&5;($ 6 $+"+!(   6  6 6 #;(5;($  6 4 6 
   
   
<%(!7+$ 
<%(!7+$ fig 13. output slice i +(
)+=6$(+)
j6k "+%)
)+=6$(+)
j6k 
)+= +"+!( *+&($ ;(5;(
j6k #7%&=+#&9"6!(
j6k 6  6 
!"#! fig 14. sct interrupt generation &%c"+ )+=6$(+) *+&($ "%=$ )+=6$(+) #
7%&=+
#&9"6!(
+*+&($ 
6&(+));5( #&9"6!(
&%c"+ )+=6$(+) #&9"6!( "%=$ )+=6$(+)
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 134 of 313 nxp semiconductors um10601 chapter 10: lpc800 state configurable timer (sct) 10.7.6 clearing the prescaler when enabled by a non-zero pre field in the control register, the prescaler acts as a clock divider for the counter, like a fractional part of the counter value. the prescaler is cleared whenever the counter is cleared or loaded for any of the following reasons: ? hardware reset ? software writing to the counter register ? software writing a 1 to the clrctr bit in the control register ? an event selected by a 1 in the counter limit register when bidir = 0 when bidir is 0, a limit event caused by an i/o signal can clear a non-zero prescaler. however, a limit event caused by a match only clears a non-zero prescaler in one special case as described section 10.7.7 . a limit event when bidir is 1 does not clear th e prescaler. rather it clears the down bit in the control register, and decrements the counter on the same clock if the counter is enabled in that clock. 10.7.7 match vs. i/o events counter operation is complicated by the prescaler and by clock mode 01 in which the sct clock is the bus clock. however, the prescale r and counter are enabled to count only when a selected edge is detected on a clock input. ? the prescaler is enabled when the clock mode is not 01, or when the input edge selected by the clksel field is detected. ? the counter is enabled when the presca ler is enabled, and (prelim=0 or the prescaler is equal to the value in prelim). an i/o component of an event can occur in an y sct clock when its counter halt bit is 0. in general, a match component of an event can only occur in a ut clock when its counter halt and stop bits are both 0 and the counter is enabled. table 133 shows when the various kinds of events can occur. table 133. event conditions combmode iomode event can occur on clock: io any event can occur whenever halt = 0 (type a). match any event can occur when halt = 0 and stop = 0 and the counter is enabled (type c). or any from the io component: event can occur whenever halt = 0 (a). from the match component: event can occur when halt = 0 and stop = 0 and the counter is enabled (c). and low or high event can occur when halt = 0 and stop = 0 and the counter is enabled (c). and rise or fall event can occur whenever halt = 0 (a).
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 135 of 313 nxp semiconductors um10601 chapter 10: lpc800 state configurable timer (sct) 10.7.8 sct operation in its simplest, single-state configuration, th e sct operates as an event controlled one- or bidirectional counter. events can be configured to be counter match events, an input or output level, transitions on an input or ou tput pin, or a combination of match and input/output behavior. in response to an even t, the sct output or outputs can transition, or the sct can perform other actions such as cr eating an interrupt or starting, stopping, or resetting the counter. multiple simultaneous actions are allowed for each event. furthermore, any number of events can tr igger one specific action of the sct. an action or multiple actions of the sct un iquely define an event. a state is defined by which events are enabled to trigger an sct action or actions in any stage of the counter. events not selected for this state are ignored. in a multi-state configuration, states change in response to events. a state change is an additional action that the sc t can perform when the event occurs. when an event is configured to change the state, the new state defines a new set of events resulting in different actions of the sct. through multip le cycles of the counter, events can change the state multiple times and thus create a larg e variety of event controlled transitions on the sct outputs and/or interrupts. once configured, the sct can run continuously without software intervention and can generate multiple output patterns entirely under the control of events. ? to configure the sct, see section 10.7.9 . ? to start, run, and stop the sct, see section 10.7.10 . ? to configure the sct as simple event controlled counter/timer, see section 10.7.11 . 10.7.9 configure the sct to set up the sct for multiple events and states, perform the following configuration steps: 10.7.9.1 configure the counter 1. configure the l and h counters in the co nfig register by selecting two independent 16-bit counters (l counter and h counter) or one combined 32-bit counter in the unify field. 2. select the sct clock sour ce in the config register (fields clkmode and clksel) from any of the inputs or an internal clock. 10.7.9.2 configure the match and capture registers 1. select how many match and capture registers the application uses (total of up to 5): ? in the regmode register, select for each of the 5 match/capture register pairs whether the register is used as a ma tch register or capture register. 2. define match conditions for each match register selected: ? each match register match sets one match value, if a 32-bit counter is used, or two match values, if the l and h 16-bit counters are used. ? each match reload register matchreload sets a reload value that is loaded into the match register when the counter reaches a limit condition or the value 0.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 136 of 313 nxp semiconductors um10601 chapter 10: lpc800 state configurable timer (sct) 10.7.9.3 configure events and event responses 1. define when each event can occur in the following way in the evn_ctrl registers (up to 6, one register per event): ? select whether the event occurs on an input or output changing, on an input or output level, a match condition of the counter, or a combination of match and input/output conditions in field combmode. ? for a match condition: select the match register that contains the match condition for the event to occur. enter the number of the selected match register in field matchsel. if using l and h counters, define whether the event occurs on matching the l or the h counter in field hevent. ? for an sct input or output level or transition: select the input number or the output number that is associated with this event in fields iosel and outsel. define how the selected input or output triggers the event (edge or level sensitive) in field iocond. 2. define what the effect of each event is on the sct outputs in the outn_set or outn_clr registers (up to 4 outputs, one register per output): ? for each sct output, select which events set or clear this output. more than one event can change the output, and each event can change multiple outputs. 3. define how each event affects the counter: ? set the corresponding event bit in the limit register for the event to set an upper limit for the counter. when a limit event occurs in unidirectional mode, the counter is cleared to zero and begins counting up on the next clock edge. when a limit event occurs in bidirectional mode, the counter begins to count down from the current value on the next clock edge. ? set the corresponding event bit in the halt register for the event to halt the counter. if the counter is halted, it stop s counting and no new events can occur. the counter operation can only be restored by clearing the halt_l and/or the halt_h bits in the ctrl register. ? set the corresponding event bit in the stop register for the event to stop the counter. if the counter is stopped, it stop s counting. however, an event that is configured as a transition on an input/output can restart the counter. ? set the corresponding event bit in the start register for the event to restart the counting. only events that are defined by an input changing can be used to restart the counter. 4. define which events contribute to the sct interrupt: ? set the corresponding event bit in the even and the evflag registers to enable the event to contribute to the sct interrupt.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 137 of 313 nxp semiconductors um10601 chapter 10: lpc800 state configurable timer (sct) 10.7.9.4 configure multiple states 1. in the evn_state register for each event (up to 6 events, one register per event), select the state or states (up to 2) in which this event is allowed to occur. each state can be selected for more than one event. 2. determine how the event affects the system state: in the evn_ctrl registers (up to 6 events, one register per event), set the new state value in the statev field for this event. if the event is the highest numbered in the current state, this value is either added to the existing state value or replaces the existing state value, depending on the field stateld. remark: if there are higher numbered events in the current state, this event cannot change the state. if the statev and stateld values are set to zero, the state does not change. 10.7.9.5 miscellaneous options ? there are a certain (selectable) number of capture registers. ea ch capture register can be programmed to capture the counter contents when one or more events occur. ? if the counter is in bidirectional mode, the ef fect of set and clear of an output can be made to depend on whether the counter is counting up or down by writing to the outputdirctrl register. 10.7.10 run the sct 1. configure the sct (see section 10.7.9 ? configure the sct ? ). 2. write to the state register to define the initia l state. by default the initial state is state 0. 3. to start the sct, write to the ctrl register: ? clear the counters. ? clear or set the stop_l and/or stop_h bits. remark: the counter starts counting once the stop bit is cleared as well. if the stop bit is set, the sct waits instead for an event to occur that is configured to start the counter. ? for each counter, select unidirectional or bidirectional counting mode (field bidir_l and/or bidir_h). ? select the prescale factor for the counter clock (ctrl register). ? clear the halt_l and/or halt_h bit. by default, the counters are halted and no events can occur. 4. to stop the counters by software at any time, stop or halt the counter (write to stop_l and/or stop_h bits or halt_l and/or halt_h bits in the ctrl register). ? when the counters are stopped, both an ev ent configured to clear the stop bit or software writing a zero to the stop bit can start the counter again. ? when the counter are halted, only a software write to clear the halt bit can start the counter again. no events can occur. ? when the counters are halted, software can set any sct output high or low directly by writing to the out register.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 138 of 313 nxp semiconductors um10601 chapter 10: lpc800 state configurable timer (sct) the current state can be read at any time by reading the state register. to change the current state by software (that is independently of any event occurring), set the halt bit and write to the state register to change the state value. writing to the state register is only allowed when the coun ter is halted (the halt_l and/or halt_h bits are set) and no events can occur. 10.7.11 configure the sc t without using states the sct can be used as standard counter/timer with external capture inputs and match outputs without using the state logic. to op erate the sct without states, configure the sct as follows: ? write zero to the state register (zero is the default). ? write zero to the stateld and statev fields in the evctrl registers for each event. ? write 0x1 to the evn_state register of each event. writing 0x1 enables the event. in effect, the event is allowed to occur in a single state which never changes while the counter is running.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 139 of 313 11.1 how to read this chapter the mrt is available on all lpc800 parts. 11.2 features ? 24-bit interrupt timer ? four channels independently counting down from individually set values ? repeat and one-shot interrupt modes 11.3 basic configuration configure the mrt using the following registers: ? in the sysahbclkctrl register, set bit 10 ( ta b l e 1 8 ) to enable the clock to the register interface. ? clear the mrt reset using the presetctrl register ( ta b l e 7 ). ? the global mrt interrupt is connected to interrupt #10 in the nvic. 11.4 pin description the mrt has no configurable pins. 11.5 general description the multi-rate timer (mrt) provides a repetiti ve interrupt timer with four channels. each channel can be programmed with an independent time interval. each channel operates independently from the other channels in one of the following modes: ? repeat interrupt mode. see section 11.5.1 . ? one-shot interrupt mode. see section 11.5.2 . the modes for each timer are set in the timer?s control register. see table 137 . um10601 chapter 11: lpc800 multi-rate timer (mrt) rev. 1.0 ? 7 november 2012 preliminary user manual
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 140 of 313 nxp semiconductors um10601 chapter 11: lpc800 multi-rate timer (mrt) 11.5.1 repeat interrupt mode the repeat interrupt mode generates repeated interrupts after a selected time interval. this mode can be used for software-based pwm or ppm applications. when the timer n is in idle state, writing a non-zero value ivalue to the intvaln register immediately loads the time interval value ivalue - 1, and the timer begins to count down from this value. when the timer reaches zero, an interrupt is generated, the value in the intvaln register ivalue - 1 is reloaded automatically, and the timer starts to count down again. while the timer is running in repeat interrupt mode, you can perform the following actions: ? change the interval value on the next timer cycle by writing a new value (>0) to the intvaln register and setting the load bit to 0. an interrupt is generated when the timer reaches zero. on the next cycle, th e timer counts down from the new value. ? change the interval value on-the-fly immediately by writing a new value (>0) to the intvaln register and setting the load bit to 1. the timer immediately starts to count down from the new timer inte rval value. an interrupt is generated when the timer reaches 0. ? stop the timer at the end of time interval by writing a 0 to the intvaln register and setting the load bit to 0. an interrupt is generated when the timer reaches zero. ? stop the timer immediately by writing a 0 to the intvaln register and setting the load bit to 1. no interrupt is generat ed when the intvaln re gister is written. fig 15. mrt block diagram  
   l-    m
 4 3 , .0/1 l, l.0/1 l l
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 141 of 313 nxp semiconductors um10601 chapter 11: lpc800 multi-rate timer (mrt) 11.5.2 one-shot interrupt mode the one-shot interrupt generates one interrup t after a one-time count. with this mode, you can generate a single interrupt at any point. th is mode can be used to introduce a specific delay in a software task. when the timer is in the idle state, writing a non-zero value ivalue to the intvaln register immediately loads the time interval va lue ivalue - 1, and the timer starts to count down. when the timer reaches 0, an interrupt is generated and the timer stops and enters the idle state. while the timer is running in the one-shot interrupt mode, you can perform the following actions: ? update the intvaln register with a new time interval value (>0) and set the load bit to 1. the timer immediately reloads the new time interval, and starts counting down from the new value. no interrupt is generated when the time_intvaln register is updated. ? write a 0 to the intvaln register and set the load bit to 1. the timer immediately stops counting and moves to the idle state. no interrupt is generated when the intvaln register is updated. 11.6 register description the reset values shown in table 134 are por reset values. table 134. register overview: mrt (base address 0x4000 4000) name access address offset description reset value reference intval0 r/w 0x0 mrt0 time interval value register. this value is loaded into the timer0 register. 0 ta b l e 1 3 5 timer0 r 0x4 mrt0 timer register. this register reads the value of the down-counter. 0x00ff ffff ta b l e 1 3 6 ctrl0 r/w 0x8 mrt0 control register . this register controls the mrt0 modes. 0 ta b l e 1 3 7 stat0 r/w 0xc mrt0 status register. 0 ta b l e 1 3 8 intval1 r/w 0x10 mrt1 time interval value register. this value is loaded into the timer1 register. 0 ta b l e 1 3 5 timer1 r/w 0x14 mrt1 timer register. this register reads the value of the down-counter. 0x00ff ffff ta b l e 1 3 6 ctrl1 r/w 0x18 mrt1 control register . this register controls the mrt1 modes. 0 ta b l e 1 3 7 stat1 r/w 0x1c mrt1 status register. 0 ta b l e 1 3 8 intval2 r/w 0x20 mrt2 time interval value register. this value is loaded into the timer2 register. 0 ta b l e 1 3 5 timer2 r/w 0x24 mrt2 timer register. this register reads the value of the down-counter. 0x00ff ffff ta b l e 1 3 6 ctrl2 r/w 0x28 mrt2 control register . this register controls the mrt2 modes. 0 ta b l e 1 3 7 stat2 r/w 0x2c mrt2 status register. 0 ta b l e 1 3 8
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 142 of 313 nxp semiconductors um10601 chapter 11: lpc800 multi-rate timer (mrt) 11.6.1 time interval register this register contains the mrt load value and controls how the timer is reloaded. the load value is ivalue -1. intval3 r/w 0x30 mrt3 time interval value register. this value is loaded into the timer3 register. 0 ta b l e 1 3 5 timer3 r/w 0x34 mrt3 timer register. this register reads the value of the down-counter. 0x00ff ffff ta b l e 1 3 6 ctrl3 r/w 0x38 mrt3 control register . this register controls the mrt modes. 0 ta b l e 1 3 7 stat3 r/w 0x3c mrt3 status register. 0 ta b l e 1 3 8 idle_ch r 0xf4 idle channel register. this register returns the number of the first idle channel. 0 ta b l e 1 3 9 irq_flag r/w 0xf8 global interrupt flag register 0 ta b l e 1 4 0 table 134. register overview: mrt (base address 0x4000 4000) name access address offset description reset value reference table 135. time interval register (intval[0: 3], address 0x4000 4000 (intval0) to 0x4000 4030 (intval3)) bit description bit symbol value description reset value 23:0 ivalue time interval load value. this value is loaded into the timern register and the mrtn starts counting down from ivalue -1. if the timer is idle, writing a non-zero value to this bit field starts the timer immediately. if the timer is running, writing a zero to this bit field does the following: ? if load = 1, the timer stops immediately. ? if load = 0, the timer stops at the end of the time interval. 0 30:24 - reserved. 0 31 load determines how the timer interval value ivalue -1 is loaded into the timern register. this bit is write-only. reading this bit always returns 0. 0 0 no force load. the load from the intvaln register to the timern register is processed at the end of the time interval if the repeat mode is selected. 1 force load. the intvaln interval value ivalue -1 is immediately loaded into the timern register while timern is running.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 143 of 313 nxp semiconductors um10601 chapter 11: lpc800 multi-rate timer (mrt) 11.6.2 timer register the timer register holds the current time r value. this register is read-only. 11.6.3 control register the control register configures the the mode for each mrt and enables the interrupt. table 136. timer register (timer[0:3], address 0x4000 4004 (timer0) to 0x4000 4034 (timer3)) bit description bit symbol description reset value 23:0 value holds the current timer value of the down-counter. the initial value of the timern register is loaded as ivalue - 1 from the intvaln register either at the end of the time interval or immediately in the following cases: intvaln register is updated in the idle state. intvaln register is updated with load = 1. when the timer is in idle state, reading this bit fields returns -1 (0x00ff ffff). 0x00ff ffff 31:24 - reserved. 0 table 137. control register (ctrl[0:3], address 0x4000 4008 (ctrl0) to 0x4000 4038 (ctrl3)) bit description bit symbol value description reset value 0 inten enable the timern interrupt. 0 0 disable. 1 enable. 2:1 mode selects timer mode. 0 0x0 repeat interrupt mode. 0x1 one-shot interrupt mode. 0x2 reserved. 0x3 reserved. 31:3 - reserved. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 144 of 313 nxp semiconductors um10601 chapter 11: lpc800 multi-rate timer (mrt) 11.6.4 status register this register indicates the status of each mrt. 11.6.5 idle channel register the idle channel register returns the lowe st idle channel number. the channel is considered idle when both flags is the status register (run and intflag) are zero. in an application with multiple timers running independently, you can calculate the register offset of the next idle timer by reading the idle channel number in this register. the idle channel register allows you set up the next idle timer without checking the idle state of each timer. table 138. status register (stat[0:3], address 0x4000 400c (stat0) to 0x4000 403c (stat3)) bit description bit symbol value description reset value 0 intflag monitors the interrupt flag. 0 0 no pending interrupt. writing a zero is equivalent to no operation. 1 pending interrupt. the interrupt is pending because timern has reached the end of the time interval. if the inten bit in the controln is also set to 1, the interrupt for timer channel n and the global interrupt are raised. writing a 1 to this bit clears the interrupt request. 1 run indicates the state of timern. this bit is read-only. 0 0 idle state. timern is stopped. 1 running. timern is running. 31:2 - reserved. 0 table 139. idle channel register (idle_ ch, address 0x4000 40f4) bit description bit symbol description reset value 3:0 - reserved. 0 7:4 chan idle channel. reading the chan bits, returns the lowest idle timer channel. if all timer channels are running, chan = 0xf. 0 31:8 - reserved. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 145 of 313 nxp semiconductors um10601 chapter 11: lpc800 multi-rate timer (mrt) 11.6.6 global interrupt flag register the global interrupt register combines the interrupt flags from the individual timer channels in one register. setting and clearing each flag behaves in the same way as setting and clearing the intflag bit in each of the statusn registers. table 140. global interrupt flag register (irq _flag, address 0x4000 40f8) bit description bit symbol value description reset value 0 gflag0 monitors the interrupt flag of timer0. 0 0 no pending interrupt. writing a zero is equivalent to no operation. 1 pending interrupt. the interrupt is pending because timer0 has reached the end of the time interval. if the inten bit in the control0 register is also set to 1, the interrupt for timer channel 0 and the global interrupt are raised. writing a 1 to this bit clea rs the interrupt request. 1 gflag1 monitors the interrupt flag of timer1. 0 0 no pending interrupt. writing a zero is equivalent to no operation. 1 pending interrupt. the interrupt is pending because timer1 has reached the end of the time interval. if the inten bit in the control1 register is also set to 1, the interrupt for timer channel 1 and the global interrupt are raised. writing a 1 to this bit clea rs the interrupt request. 2 gflag2 monitors the interrupt flag of timer2. 0 0 no pending interrupt. writing a zero is equivalent to no operation. 1 pending interrupt. the interrupt is pending because timer2 has reached the end of the time interval. if the inten bit in the control2 register is also set to 1, the interrupt for timer channel 2 and the global interrupt are raised. writing a 1 to this bit clea rs the interrupt request. 3 gflag3 monitors the interrupt flag of timer3. 0 0 no pending interrupt. writing a zero is equivalent to no operation. 1 pending interrupt. the interrupt is pending because timer3 has reached the end of the time interval. if the inten bit in the control3 register is also set to 1, the interrupt for timer channel 3 and the global interrupt are raised. writing a 1 to this bit clea rs the interrupt request. 31:4 - reserved. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 146 of 313 12.1 how to read this chapter the watchdog timer is identical on all lpc800 parts. 12.2 features ? internally resets chip if not reloaded during the programmable time-out period. ? optional windowed operation requires reload to occur between a minimum and maximum time-out period, both programmable. ? optional warning interrupt can be generated at a programmable time prior to watchdog time-out. ? programmable 24-bit timer with internal fixed pre-scaler. ? selectable time period from 1,024 watchdog clocks (t wdclk ? 256 ? 4) to over 67 million watchdog clocks (t wdclk ? 2 24 ? 4) in increments of 4 watchdog clocks. ? ?safe? watchdog operation. once enabled, requires a hardware reset or a watchdog reset to be disabled. ? incorrect feed sequence causes i mmediate watchdog event if enabled. ? the watchdog reload value can optionally be protected such that it can only be changed after the ?warning interrupt? time is reached. ? flag to indicate watchdog reset. ? the watchdog clock (wdclk) source is the watchdog oscillator. ? the watchdog timer can be configured to run in deep-sleep or power-down mode. ? debug mode. 12.3 basic configuration the wwdt is configured through the following registers: ? power to the register in terface (wwdt pclk clock): in the sysahbclkctrl register, set bit 17 in ta b l e 1 8 . ? enable the wwdt clock source (the watchdog oscillator) in the pdruncfg register ( ta b l e 3 7 ). this is the clock source for the timer base. ? for waking up from a wwdt interrupt, enable the watchdog interrupt for wake-up in the starterp1 register ( table 34 ). 12.4 pin description the wwdt has no external pins. um10601 chapter 12: lpc800 window ed watchdog timer (wwdt) rev. 1.0 ? 7 november 2012 preliminary user manual
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 147 of 313 nxp semiconductors um10601 chapter 12: lpc800 windowed watchdog timer (wwdt) 12.5 general description the purpose of the watchdog timer is to re set or interrupt the microcontroller within a programmable time if it enters an erroneous state. when enabled, a watchdog reset is generated if the user program fails to feed (reload) the watchdog within a predetermined amount of time. when a watchdog window is programmed, an early watchdog feed is also treated as a watchdog event. this allows preventing situat ions where a system failure may still feed the watchdog. for example, application code co uld be stuck in an interrupt service that contains a watchdog feed. setting the window su ch that this would result in an early feed will generate a watchdog event, a llowing for system recovery. the watchdog consists of a fixed (divide by 4) pre-scaler and a 24-bit counter which decrements when clocked. the minimum value from which the counter decrements is 0xff. setting a value lower than 0xff causes 0xff to be loaded in the counter. hence the minimum watchdog interval is (t wdclk ? 256 ? 4) and the maximum watchdog interval is (t wdclk ? 2 24 ? 4) in multiples of (t wdclk ? 4). the watchdog should be used in the following manner: ? set the watchdog timer constant reload value in the tc register. ? set the watchdog timer operating mode in the mod register. ? set a value for the watchdog window time in the window register if windowed operation is desired. ? set a value for the watchdog warning interrupt in the warnint register if a warning interrupt is desired. ? enable the watchdog by writing 0xaa followed by 0x55 to the feed register. ? the watchdog must be fed again before the watchdog counter reaches zero in order to prevent a watchdog event. if a window value is programmed, the feed must also occur after the watchdog co unter passes that value. when the watchdog timer is co nfigured so that a watchdo g event will caus e a reset and the counter reaches zero, t he cpu will be reset, loading th e stack pointer and program counter from the vector table as for an ex ternal reset. the watchdog time-out flag (wdtof) can be examined to determine if the watchdog has caused the reset condition. the wdtof flag must be cleared by software. when the watchdog timer is co nfigured to genera te a warning interr upt, the interrupt will occur when the counter matches the value defined by the warnint register. 12.5.1 block diagram the block diagram of the watchdog is shown below in the figure 16 . the synchronization logic (pclk - wdclk) is not shown in the block diagram.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 148 of 313 nxp semiconductors um10601 chapter 12: lpc800 windowed watchdog timer (wwdt) 12.5.2 clocking and power control the watchdog timer block uses two clocks: pc lk and wdclk. pclk is used for the apb accesses to the watchdog registers and is derived from the system clock (see figure 3 ). the wdclk is used for the watchdog timer counting and is derived from the watchdog oscillator. the synchronization logic between the two clock domains works as follows: when the mod and tc registers are updated by apb oper ations, the new value will take effect in 3 wdclk cycles on the logic in the wdclk clock domain. when the watchdog timer is counting on wdclk, the synchronization logic will first lock the value of the counter on wdclk and then synchronize it with pclk, so that the cpu can read the wdtv register. remark: because of the synchronization step, software must add a delay of three wdclk clock cycles between the feed sequen ce and the time the wdprotect bit is enabled in the mod register. the length of the delay depends on the selected watchdog clock wdclk. fig 16. windowed watchdog timer block diagram :%(!7'#=
6&(+));5( 
a .1b  
a .1b 
a ./1b 
a .,1b !765
)+$+( n  9++'
# :'-!" 
   
)+=6$(+) !#<5%)+  4 !#<5%)+      9++'
$+h;+&!+
'+(+!(
%&'
5)#(+!(6#&   9++'
# !#<5%)+ ,      c6(
'#:&
!#;&(+)  4   $7%'#:
c6(    !" 
:)6(+
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 149 of 313 nxp semiconductors um10601 chapter 12: lpc800 windowed watchdog timer (wwdt) 12.5.3 using the wwdt lock features the wwdt supports several lock features which can be enabled to ensure that the wwdt is running at all times: ? disabling the wwdt clock source ? changing the wwdt reload value 12.5.3.1 disabling the wwdt clock source if bit 5 in the wwdt mod register is set, the wwdt clock source is locked and can not be disbled either by software or by hard ware when sleep, deep-sleep or power-down modes are entered. ther efore, the user must ensure t hat the watchdog oscillator for each power mode is enabled before setting bit 5 in the mod register. in deep power-down mode, no clock locking mechanism is in effect because no clocks are running. however, an additional lock bit in the pmu can be set to prevent the part from even entering deep power-down mode (see ta b l e 4 2 ). 12.5.3.2 changing the wwdt reload value if bit 4 is set in the wwdt mod register, the watchdog time-out value (tc) can be changed only after the counter is belo w the value of wdwarnint and wdwindow. the reload overwrite lock mechanism can only be disabled by a reset of any type.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 150 of 313 nxp semiconductors um10601 chapter 12: lpc800 windowed watchdog timer (wwdt) 12.6 register description the watchdog timer contains the registers shown in table 141 . the reset value reflects the data stored in used bits only. it does not include the content of reserved bits. 12.6.1 watchdog mode register the wdmod register controls the operation of the watchdog. note that a watchdog feed must be performed before any changes to the wdmod register take effect. table 141. register overview: watchdog timer (base address 0x4000 4000) name access address offset description reset value reference mod r/w 0x000 watchdog mode register. this register contains the basic mode and status of the watchdog timer. 0 table 142 tc r/w 0x004 watchdog timer constant register. this 24-bit register determines the time-out value. 0xff table 144 feed wo 0x008 watchdog feed sequence register. writing 0xaa followed by 0x55 to this register reloads the watchdog timer with the value contained in wdtc. na table 145 tv ro 0x00c watchdog timer value register. this 24-bit register reads out the current value of the watchdog timer. 0xff table 146 - - 0x010 reserved - - warnint r/w 0x014 watchdog warning interrupt compare value. 0 table 147 window r/w 0x018 watchdog window compare value. 0xff ffff table 148 table 142. watchdog mode register (mod - 0x4000 4000) bit description bit symbol value description reset value 0 wden watchdog enable bit. once this bit has been written with a 1, it cannot be re-written with a 0. once this bit is set to one, the watchdog timer starts running after a watchdog feed. 0 0 the watchdog timer is stopped. 1 the watchdog timer is running. 1 wdreset watchdog reset enable bit. once this bit has been written with a 1 it cannot be re-written with a 0. 0 0 a watchdog time-out will not cause a chip reset. 1 a watchdog time-out will cause a chip reset. 2 wdtof watchdog time-out flag. set when the watchdog timer times out, by a feed error, or by events associated with wdprotect. cleared by software. causes a chip reset if wdreset = 1. 0 (only after external reset)
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 151 of 313 nxp semiconductors um10601 chapter 12: lpc800 windowed watchdog timer (wwdt) once the wden , wdprotect , or wdreset bits are set they can not be cleared by software. both flags are cleared by an external reset or a watchdog timer reset. wdtof the watchdog time-out flag is set when the watchdog times out, when a feed error occurs, or when protect =1 and an attempt is made to write to the tc register. this flag is cleared by soft ware writing a 0 to this bit. wdint the watchdog interrupt flag is set when the watchdog counter reaches the value specified by warnint. this flag is cleared when any reset occurs, and is cleared by software by writing a 0 to this bit. in all power modes except deep power-down mode, a watchdog reset or interrupt can occur when the watchdog is running and has an operating clock source. the watchdog oscillator can be configured to keep running in sleep, de ep-sleep modes, and power-down modes. if a watchdog interrupt occurs in sleep, deep-sleep mode, or power-down mode, and the wwdt interrupt is enabled in th e nvic, the device will wake up . note that in deep-sleep and power-down modes, the wwdt interrupt must be enabled in the starterp1 register in addition to the nvic. see the following registers: table 34 ? start logic 1 interrupt wake-up enable register (starterp1, address 0x4004 8214) bit description ? 3 wdint warning interrupt flag. set when the timer reaches the value in wdwarnint. cleared by software. 0 4 wdprotect watchdog update mode. this bit can be set once by software and is only cleared by a reset. 0 0 the watchdog time-out value (tc) can be changed at any time. 1 the watchdog time-out value (tc) can be changed only after the counter is below the value of wdwarnint and wdwindow. 5 lock a 1 in this bit prevents disabling or powering down the watchdog oscillator. this bit can be set once by software and is only cleared by any reset. 0 31:6 - reserved, user software should not write ones to reserved bits. the value read from a reserved bit is not defined. na table 142. watchdog mode register (mod - 0x4000 4000) bit description bit symbol value description reset value
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 152 of 313 nxp semiconductors um10601 chapter 12: lpc800 windowed watchdog timer (wwdt) 12.6.2 watchdog timer constant register the tc register determines the time-out valu e. every time a feed sequence occurs the value in the tc is loaded into the watchdog timer. the tc resets to 0x00 00ff. writing a value below 0xff will cause 0x00 00ff to be loaded into the tc . thus the minimum time-out interval is t wdclk ? 256 ? 4. if the wdprotect bit in wdmod = 1, an atte mpt to change the value of tc before the watchdog counter is below the values of wdwarni nt and wdwindow will cause a watchdog reset and set the wdtof flag. 12.6.3 watchdog feed register writing 0xaa followed by 0x55 to this regist er will reload the watchdog timer with the wdtc value. this operation will also start the watchdog if it is enabled via the wdmod register. setting the wden bit in the wdmod register is not sufficient to enable the watchdog. a valid feed sequence must be completed after setting wden before the watchdog is capable of gener ating a reset. until then, the watchdog will ignore feed errors. after writing 0xaa to wdfeed, access to any watchdog register other than writing 0x55 to wdfeed causes an immediate reset/inte rrupt when the watchdog is enabled, and sets the wdtof flag. the reset will be gener ated during the second pclk following an incorrect access to a watchdog register during a feed sequence. it is good practice to disable interrupts around a feed sequence, if the application is such that an interrupt might result in rescheduling processor control away from the current task in the middle of the feed, and then lead to some other access to the wdt before control is returned to the interrupted task. table 143. watchdog operating modes selection wden wdreset mode of operation 0 x (0 or 1) debug/operate without the watchdog running. 1 0 watchdog interrupt mode: the watch dog warning interrupt will be generated but watchdog reset will not. when this mode is selected, the wa tchdog counter reaching the value specified by wdwarnint will set the wdint flag and the watchdog interrupt request will be generated. 1 1 watchdog reset mode: both the watchdog interrupt and watchdog reset are enabled. when this mode is selected, the wa tchdog counter reaching the value specified by wdwarnint will set the wdint flag and the watchdog interrupt request will be generated, and the watchdog counter reaching zero will reset the microcontroller. a watchdog feed prior to reaching the value of wdwindow will also cause a watchdog reset. table 144. watchdog timer constant register (tc - 0x4000 4004) bit description bit symbol description reset value 23:0 count watchdog time-out value. 0x00 00ff 31:24 - reserved, user software should not write ones to reserved bits. the value read from a reserved bit is not defined. na
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 153 of 313 nxp semiconductors um10601 chapter 12: lpc800 windowed watchdog timer (wwdt) 12.6.4 watchdog timer value register the wdtv register is used to read the current value of watchdog timer counter. when reading the value of the 24-bit counter, the lock and synchronization procedure takes up to 6 wdclk cycles plus 6 pclk cycles, so the value of wdtv is older than the actual value of the timer when it's being read by the cpu. 12.6.5 watchdog timer warning interrupt register the wdwarnint register determines t he watchdog timer counter value that will generate a watchdog interrupt. when the watchdog timer counter matches the value defined by warnint, an interrupt will be generated after th e subsequent wdclk. a match of the watchdog timer counter to warnint occurs when the bottom 10 bits of the counter have the same value as the 10 bits of warnint, and the remaining upper bits of the counter are all 0. this gives a maximu m time of 1,023 watchdog timer counts (4,096 watchdog clocks) for the interrupt to occur prio r to a watchdog event. if warnint is 0, the interrupt will occur at the same time as the watchdog event. 12.6.6 watchdog timer window register the window register determines the highest wdtv value allowed when a watchdog feed is performed. if a feed sequence occurs when wdtv is greater than the value in window, a watchdog event will occur. window resets to the maximum possible wd tv value, so windowing is not in effect. table 145. watchdog feed register (f eed - 0x4000 4008) bit description bit symbol description reset value 7:0 feed feed value should be 0xaa followed by 0x55. na 31:8 - reserved, user software should not write ones to reserved bits. the value read from a reserved bit is not defined. na table 146. watchdog timer value register (tv - 0x4000 400c) bit description bit symbol description reset value 23:0 count counter timer value. 0x00 00ff 31:24 - reserved, user software should not write ones to reserved bits. the value read from a reserved bit is not defined. na table 147. watchdog timer wa rning interrupt register (warnint - 0x4000 4014) bit description bit symbol description reset value 9:0 warnint watchdog warning interrupt compare value. 0 31:10 - reserved, user software should not write ones to reserved bits. the value read from a reserved bit is not defined. na
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 154 of 313 nxp semiconductors um10601 chapter 12: lpc800 windowed watchdog timer (wwdt) 12.7 functional description the following figures illustra te several aspects of wa tchdog timer operation. table 148. watchdog timer window register (window - 0x4000 4018) bit description bit symbol description reset value 23:0 window watchdog window value. 0xff ffff 31:24 - reserved, user software should not write ones to reserved bits. the value read from a reserved bit is not defined. na fig 17. early watchdog feed with windowed mode enabled 8 8 8? 8> 

%(!7'#=
#;&(+) %)"d
++'
*+&( %(!7'#=
+$+( #&'6(6#&$ 0  i
,2,,  i
,2/  i
,2,,, fig 18. correct watchdog feed with windowed mode enabled #))+!(
++'
*+&( ,  ,, 

%(!7'#=
#;&(+) %(!7'#=
+$+(   ,,,      #&'6(6#&$ 0  i
,2,,  i
,2/   i
,2,,, fig 19. watchdog warning interrupt %(!7'#=
&(+));5( , ,/ , , , , 

%(!7'#=
#;&(+) ,/ ,/ ,/ ,/ ,/ , ,, ,/ ,/? #&'6(6#&$ 0  i
,2,,  i
,2/  i
,2,,,
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 155 of 313 13.1 how to read this chapter the analog comparator is available on all lpc800 parts. 13.2 features ? selectable external inputs can be used as either the positive or negative input of the comparator. ? the internal voltage reference (0.9 v bandgap reference) can be used as either the positive or negative input of the comparator. ? 32-stage voltage ladder can be used as eit her the positive or negative input of the comparator. ? voltage ladder source selectable between the supply pin v dd or vddcmp pin. ? voltage ladder can be separately powered down when not required. ? interrupt capability 13.3 basic configuration configure the analog comparator using the following registers: ? in the sysahbclkctrl register, set bit 19 ( ta b l e 1 8 ) to enable the clock to the register interface. ? you can enable or disable the power to the analog comparator through the pdruncfg register ( table 37 ). ? clear the analog comparat or peripheral reset using the presetctrl register ( ta b l e 7 ). ? the analog comparator interrupt is connected to interrupt #11 in the nvic. ? configure the analog comparator pin functions through the switch matrix. see section 13.4 . 13.3.1 connect the compar ator output to the sct you can use the comparator output function (acmp_o) to start or stop the sct or, more generally, create an sct event. to create an sct event, connect amp_o as follows: 1. using the switch matrix, co nnect acmp_o to a pin. see table 149 . 2. using the switch matrix, connect any of th e sct input functions to the same pin. see table 106 . the selected sct input can now monitor the acmp_o function. um10601 chapter 13: lpc800 analog comparator rev. 1.0 ? 7 november 2012 preliminary user manual
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 156 of 313 nxp semiconductors um10601 chapter 13: lpc800 analog comparator 13.4 pin description the analog comparator reference voltage, the inputs, and the output are assigned to external pins through the switch matrix. you can assign the analog comparator output to any pin on the package that is not a supply or ground pin. the comparator inputs and the reference voltage are fixed-pin functions that must be enabled through the switch matrix and can only be assigned to special pins on the package. see section 9.3.1 ? connect an internal signal to a package pin ? to assign the analog comparator output to any pin on the lpc800 package. see section 9.3.2 to enable the analog comparator inputs and the reference voltage input. 13.5 general description the analog comparator can compare voltage levels on external pins and internal voltages. the comparator has 8 inputs multiplexed separately to its positive and negative inputs. the multiplexers are controlled by the comparator register ctl (see figure 20 and table 151 ). input 0 of the multiplexers is the programmable voltage ladder output. bits 2:1 control the external inputs acmp_i[2:1]. bits 6 of the multiplexers controls internal reference voltage input. table 149. analog comparator pin description function type pin description swm register reference acmp_i1 i pio0_0/acmp_i1 comparator input 1 pinenable0 section 9.5.10 acmp_i2 i pio0_0/acmp_i2/clkin comparator input 2. disable the clkin function in the pinsassign1bit0 register. pinenable0 section 9.5.10 acmp_o o any comparator output pinassign8 section 9.5.9 vddcmp i pio0_6/vddcmp external reference voltage source for 32-stage voltage ladder. pinenable0 section 9.5.10
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 157 of 313 nxp semiconductors um10601 chapter 13: lpc800 analog comparator 13.5.1 reference voltages the voltage ladder can use two referenc e voltages, from the vddcmp or the v dd pin. the voltage ladder selects one of 32 steps between the pin voltage and v ss inclusive. the voltage on vddcmp should not exceed that on v dd . 13.5.2 settling times after the voltage ladder is powered on, it requires stabilization ti me until comparisons using it are accurate. much shorter settlin g times apply after the ladsel value is changed and when either or both voltage sources are changed. software can deal with these factors by repeatedly reading the comparator output until a number of readings yield the same result. 13.5.3 interrupts the interrupt output comes from edge detection circuitry in this module. rising edges, falling edges, or both edges can set the co mpedge bit and thus request an interrupt. compedge and the interrupt request are cleared when software writes a 1 to edgeclr. fig 20. comparator block diagram , > , / , > ,  4  +2(@
4  
o
&-  -4- p    -4- - - 6&(+)&%"
,@?4
 4 

 -  c;9 ,     

/
 
      
#) - -  a(#
  b c;9   (#
-
 

  
 
  - - 4 4 4 4 &@!@
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 158 of 313 nxp semiconductors um10601 chapter 13: lpc800 analog comparator 13.5.4 comparator outputs the comparator output (conditi oned by compsa bit) can be ro uted to an external pin. when compsa is 0 and the co mparator interrupt is dis abled, the comp arator can be used with the bus clock disabled ( table 18 ? system clock control register (sysahbclkctrl, address 0x4004 8080) bit description ? ) to save power if the control registers don?t need to be written. the status of the comparator output can be observed through the comparator status register bit. the comparator output can be routed to the sct via the switch matrix allowing to capture the time of a voltage crossing or to count crossings in either or both directions. see section 13.3.1 ? connect the comparator output to the sct ? . 13.6 register description 13.6.1 comparator control register this register enables the comparator, confi gures the interrupts, and controls the input multiplexers on both sides of the comparator. all bits not shown in table 151 are reserved and should be written as 0. table 150. register overview: analog comparator (base address 0x4002 4000) name access address offset description reset value ctrl r/w 0x000 comparator control register 0 lad r/w 0x004 voltage ladder register 0 table 151. comparator control register (ctrl, address 0x4002 4000) bit description bit symbol value description reset value 2:0 - reserved. write as 0. 0 4:3 edgesel this field controls which edges on the comparator output set the compedge bit (bit 23 below): 0 0x0 falling edges 0x1 rising edges 0x2 both edges 0x3 both edges 5 - reserved. write as 0. 0 6 compsa comparator output control 0 0 comparator output is used directly. 1 comparator output is synchronized to the bus clock for output to other modules. 7 - reserved. write as 0. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 159 of 313 nxp semiconductors um10601 chapter 13: lpc800 analog comparator 10:8 comp_vp_sel selects po sitive voltage input 0 0x0 voltage ladder output 0x1 acmp_i1 0x2 acmp_i2 0x3 reserved 0x4 reserved 0x5 reserved 0x6 internal reference voltage 0x7 reserved 13:11 comp_vm_sel selects negative voltage input 0 0x0 voltage ladder output 0x1 acmp_i1 0x2 acmp_i2 0x3 reserved 0x4 reserved 0x5 reserved 0x6 internal reference voltage 0x7 reserved 19:14 - reserved. write as 0. 0 20 edgeclr interrupt clear bit. to clear the compedge bit and thus negate the interrupt request, toggle the edgeclr bit by first writing a 1 and then a 0. 0 21 compstat comparator status. this bit reflects the state of the comparator output. 0 22 - reserved. write as 0. 0 23 compedge comparator edge-detect status. 0 24 - reserved. write as 0. 0 26:25 hys controls the hysteresis of the comparator. when the comparator is outputting a certain state, this is the difference between the selected signals, in the opposite direction from the state being output, that will switch the output. 0 0x0 none (the output will swit ch as the voltages cross) 0x1 5 mv 0x2 10 mv 0x3 20 mv 31:27 - reserved - table 151. comparator control register (ctrl, address 0x4002 4000) bit description bit symbol value description reset value
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 160 of 313 nxp semiconductors um10601 chapter 13: lpc800 analog comparator 13.6.2 voltage ladder register this register enables and controls the voltage ladder. the fraction of the reference voltage produced by the ladder is programmable in steps of 1/31. table 152. voltage ladder register (l ad, address 0x4002 4004) bit description bit symbol value description reset value 0 laden voltage ladder enable 0 5:1 ladsel voltage ladder value. the reference voltage vref depends on the ladref bit below. 00000 = v ss 00001 = 1 ?? vref/31 00010 = 2 ?? vref/31 ... 11111 = vref 0 6 ladref selects the reference voltage vref for the voltage ladder: 0 0 supply pin v dd 1 vddcmp pin 31:7 - reserved. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 161 of 313 14.1 how to read this chapter the self wake-up timer is av ailable on all lpc800 parts. 14.2 features ? 32-bit loadable down-counter. counter starts automatically when a count value is loaded. time-out generates an interrupt/wake up request. ? the wkt resides in a separate, always-on power domain. ? the wkt supports two clo ck sources. one clock sour ce originates from the always-on power domain. ? the wkt can be used for waking up the part from any low power mode, including deep power-down mode, or for general-purpose timing. 14.3 basic configuration ? in the sysahbclkctrl register, set bit 9 ( table 18 ) to enable the clock to the register interface. ? clear the wkt reset using the presetctrl register ( ta b l e 7 ). ? the wkt interrupt is connected to interrupt #15 in the nvic. ? enable the low power os cillator in the pmu ( ta b l e 4 5 ). ? enable the irc and irc output in the pdruncfg register ( ta b l e 3 7 ). ? see section 5.7.1 to enable the various power down modes. 14.4 pin description the wkt has no configurable pins. 14.5 general description the self wake-up timer is a 32 -bit, loadable down-counter. writing any non-zero value to this timer automatically enables the counter and launches a count-down sequence. when the counter is being used as a wake up timer, this write can occur just prior to entering a reduced power mode. when a starting count value is loaded, the self wake-up timer au tomatically turns on, counts from the pre-loaded value down to zero, generates an interrupt and/or a wake up request, and then turns itself off until re -launched by a subsequent software write. 14.5.1 wkt clock sources the self wake-up timer can be clocked from two alternative clock sources: ? a 750 khz clock derived from the irc os cillator. this is the default clock, um10601 chapter 14: lpc800 self wake-up timer (wkt) rev. 1.0 ? 7 november 2012 preliminary user manual
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 162 of 313 nxp semiconductors um10601 chapter 14: lpc800 self wake-up timer (wkt) ? a 10 khz, low-power clock with a dedica ted on-chip oscillator as clock source. the irc-derived clock is much more accurate than the alternative, low-power clock. however, the irc is not available in most low-power modes. this clock must not be selected when the timer is being used to wake up from a power mode where the irc is disabled. the alternative clock source is a (nominally) 10 khz, low- power clock, sourced from a dedicated oscillator. this oscillator resides in the always-on voltage domain, so it can be programmed to continue operating in deep power-down mode when power is removed from the rest of the part. this clock is al so be available during other low-power modes when the irc clock is shut-down. the low-power oscillator is not accurate (approximately +/- 45% over process and temperature). the frequency measurement feature (if available) can be used to determine what the actual frequency is before selecting a time-out value to write into the self wake-up timer. the freque ncy may still drift, however, while counting is in progress - particularly due to reduced chip temperature after a low-power mode is entered. 14.6 register description 14.6.1 control register the wkt interrupt must be enabled in the nvic to wake up the part using the self wake-up counter. table 153. register overview: wkt (base address 0x4000 8000) name access address offset description reset value reference ctrl r/w 0x0 self wake-up timer control register. 0 table 154 count r/w 0xc counter register. table 154. control register (ctrl, address 0x4000 8000) bit description bit symbol value description reset value 0 clksel select the self wa ke-up timer clock source. 0 0 divided irc clock. this clock runs at 750 khz and provides time-out periods of up to approximately 95 minutes in 1.33 s increments. remark: this clock is not available in not available in deep-sleep, power-down, deep power-down modes. do not select this option if the timer is to be used to wake up from one of these modes. 1 low power clock. this is the (nominally) 10 khz clock and provides time-out periods of up to approximately 119 hours in 100 s increments. the accuracy of this clock is limited to +/- 45 % over temperature and processing. remark: this clock is available in all power modes. prior to use, the low-power oscillator must be enabled. the oscillator must also be set to remain active in deep power-down if needed.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 163 of 313 nxp semiconductors um10601 chapter 14: lpc800 self wake-up timer (wkt) 14.6.2 count register do not write to this register wh ile the counting is in progress. remark: in general, reading the timer state is not recommended. there is no mechanism to ensure that some bits of this register don't change while a read is in progress if the read happens to coincide with an self wake-up timer clock edge. if you must read this value, it is recommended to read it twice in succession. 1 alarmflag wake-up or alarm timer flag. - 0 no time-out. the self wake-up timer has not timed out. writing a 0 to has no effect. 1 time-out. the self wake-up timer has timed out. this flag generates an interrupt request which can wake up the part from any reduced power mode including deep power-down if the clock source is the low power oscillator. writing a 1 clears this status bit. 2 clearctr clears the self wake-up timer. 0 0 no effect. reading this bit always returns 0. 1 clear the counter. counting is halted until a new count value is loaded. 31:3 - reserved. - table 154. control register (ctrl, address 0x4000 8000) bit description bit symbol value description reset value table 155. counter register (count, address 0x4000 800c) bit description bit symbol description reset value 31:0 value a write to this register pre-loads start count value into the timer and starts the count-down sequence. a read reflects the current value of the timer. -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 164 of 313 15.1 how to read this chapter usart0 and usart1 are available on all parts. usart2 is available on parts lpc812m101fdh16 and LPC812M101FDH20 only. read this chapter for a description of the usart peripheral and the software interface. the lpc800 also provides an on-chip rom-based usart api to configure and operate the usart. see table 271 . 15.2 features ? 7, 8, or 9 data bits and 1 or 2 stop bits ? synchronous mode with master or slave operation. includes data phase selection and continuous clock option. ? multiprocessor/multidrop (9-bit) mode with software address compare. (rs-485 possible with software address detection and transceiver direction control.) ? parity generation and checking: odd, even, or none. ? one transmit and one receive data buffer. ? rts/cts for hardware signaling for automatic flow control. software flow control can be performed using delta cts detect, transmit disable control, and any gpio as an rts output. ? received data and status can optionally be read from a single register ? break generation and detection. ? receive data is 2 of 3 sample "voting". status flag set when one sample differs. ? built-in baud rate generator. ? a fractional rate divider is shared among all uarts. ? interrupts available for receiver ready, tr ansmitter ready, receiver idle, change in receiver break detect, framing error, pari ty error, overrun, underrun, delta cts detect, and receiver sa mple noise detected. ? separate data and flow control loopback modes for testing. ? baud rate clock can also be output in asynchronous mode. 15.3 basic configuration remark: the on-chip usart api provides software routines to configure and use the usart. see table 271 . configure usart0/1/2 for receiving and transmitting data: ? in the sysahbclkctrl register, set bit 14 to 16 ( ta b l e 1 8 ) to enable the clock to the register interface. ? clear the usart0/1/2 peripheral rese ts using the presetctrl register ( table 7 ). um10601 chapter 15: lpc800 usart0/1/2 rev. 1.0 ? 7 november 2012 preliminary user manual
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 165 of 313 nxp semiconductors um10601 chapter 15: lpc800 usart0/1/2 ? enable or disable the usart0/1/2 interrupts in slots #3 to 5 in the nvic. ? configure the usart0/1/2 pin functi ons through the switch matrix. see section 15.4 . ? configure the usart clock and baud rate. see section 15.3.1 . configure the usart0/1/2 to wake up the part from low power modes: ? configure the usart to receive and transmit data in synchronous slave mode. see section 15.3.2 . 15.3.1 configure the us art clock and baud rate all three usarts use a common peripheral clock (u_pclk) and, if needed, a fractional baud rate generator.the peripheral clock and the fractional divider for the baud rate calculation are set up in the syscon block as follows (see figure 21 ): 1. configure the uart clock by writing a value uartclkdiv > 0 in the usart peripheral clock divider register. this is the divided main clock common to all usarts. section 4.6.14 ? usart clock divider register ? 2. if a fractional value is needed to obtain a particular baud rate, program the fractional divider. the fractional divider value is the fraction of mult/div. the mult value is programmed in the uartfrgmult register and the div value is programmed in the uartfrgdiv register in the syscon block. u_pclk = uartclkdiv/(1+mult/div) the following rules appl y for mult and div: ? always set div to 256 by programming t he uartfrgdiv register with the value of 0xff. ? program any value between 0 and 255 in the uartfrgmult register. ? the fraction of mult/div must be smaller than 1. section 4.6.19 ? usart fractional generator multiplier value register ? section 4.6.18 ? usart fractional generator divider value register ? 3. in asynchronous mode: configure the baud rate divider brgval in the usartn brg register. the baud rate divider divides the common usart peripheral clock by a factor of 16 multiplied by the baud rate value to provide the baud rate = u_pclk/16 x brgval. section 15.6.9 ? usart baud rate generator register ? 4. in synchronous mode: the serial clock is un_sclk = u_pclk/brgval
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 166 of 313 nxp semiconductors um10601 chapter 15: lpc800 usart0/1/2 for details on the clock configuration see: section 15.7.1 ? clocking and baud rates ? 15.3.2 configure the usart for wake-up the usart can wake up the system from sl eep mode in asynchronous or synchronous mode on any enabled usart interrupt. if the usart is configured for synchronous slave mode, the usart block can create an interrupt on a received signal even when the usart block receives no clocks from the arm cortex-m0+ core - that is in deep-sleep or power-down mode. as long as the usart receives a clock signal from the master, it can receive up to one byte in the rxdata register while in deep-sleep or power-down mode. any interrupt raised as part of the receive data process can then wake up the part. 15.3.2.1 wake-up from sleep mode ? configure the usart in either asynchronous mode or synchronous mode. see table 158 . ? enable the usart inte rrupt in the nvic. ? any usart interrupt wakes up the part from sleep mode. enable the usart interrupt in the intenset register ( table 161 ). fig 21. usart clocking  4   <%6&
!"#! -
i
 4a
p
 4b    4   , 
      
      
   ,- - -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 167 of 313 nxp semiconductors um10601 chapter 15: lpc800 usart0/1/2 15.3.2.2 wake-up from deep-sleep or power-down mode ? configure the usart in synchronous slave mode. see table 158 . you must connect the sclk function to a pin and connect the pin to the master. ? enable the usart interrupt in the starterp1 register. see table 34 ? start logic 1 interrupt wake-up enable register (starterp1, address 0x4004 8214) bit description ? . ? enable the usart inte rrupt in the nvic. ? the usart wakes up the part from deep-sleep or power-down mode on all events that cause an interrupt and also are enabled in the intenset register. typical wake-up events are: ? a received start bit has been detected. ? an address bit has been sent. ? the rxdata buffer has received one byte and is full. ? data are ready to be transmitted in the txdata buffer and a serial clock from the master has been received. ? a change in the state of the cts pin if the cts function is connected. ? remark: by enabling or disabling the inte rrupt in the intenset register ( table 161 ), you can customize when the wake-up occurs in the usart receive/transmit protocol. 15.4 pin description the usart receive, transmit, and control signals are movable functions and are assigned to external pins through the switch matrix. see section 9.3.1 ? connect an internal signal to a package pin ? to assign the usart functions to pins on the lpc800 package. table 156. usart pin description function direction pin description swm register reference u0_txd o any transmitter output for usar t0. serial transm it data. pinassign0 ta b l e 9 6 u0_rxd i any receiver input for usar t0. serial receiv e data. pinassign0 ta b l e 9 6 u0_rts o any request to send output for usart0. active low signal for supports inter-processor communication through the use of hardware flow control. this feature is active when the usart rts signal is configured to appear on a device pin. pinassign0 ta b l e 9 6 u0_cts i any clear to send input for usart0. active low signal indicates if the external device that is in communication with the usart is ready to accept data. this feature is active when enabled by the ctsen bit in cfg register and when configured to appear on a device pin. when deasserted (high) by the external device, the usart will complete transmitting any character already in progress, then stop until cts is again asserted (low). pinassign0 ta b l e 9 6
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 168 of 313 nxp semiconductors um10601 chapter 15: lpc800 usart0/1/2 15.5 general description the usart receiver block monitors the serial input line, un_rxd, for valid input. the receiver shift register assembles characters as they are received, after which they are passed to the receiver buffer register to await access by the cpu. the usart transmitter block accepts data written by the cpu and buffers the data in the transmit holding register. when th e transmitter is available, the transmit shift register takes that data, formats it, and serializes it to the serial output, un_txd. the baud rate generator block divides the incoming clock to create a 16x baud rate clock in the standard asynchronous operating mode. the brg clock input source is the shared fractional rate generator that runs from the common usart peripheral clock u_pclk). in synchronous slave mode, data is transmitted and received using the serial clock directly. in synchronous master mode, data is transmitted and received using the baud rate clock without division. status information from the transmitter and re ceiver is saved and provided via the stat register. many of the status flags are able to generate interrupts, as selected by software. remark: the fractional value and the usart peripheral clock are shared between all usarts. u0_sclk i/o any serial clock input/output for usart0 in synchronous mode. clock input or output in synchronous mode. if connected to a pin in asynchronous mode, will output the baud rate clock if the syncmst bit in cfg register is set to 1. pinassign1 ta b l e 9 7 u1_txd o any transmitter output for usar t1. serial transm it data. pinassign1 ta b l e 9 7 u1_rxd i any receiver inpu t for usart1. pinassign1 ta b l e 9 7 u1_rts o any request to send output for usart1. pinassign1 ta b l e 9 7 u1_cts i any clear to send input for usart1. pinassign2 ta b l e 9 8 u1_sclk i/o any serial clock input/output for usart1 in synchronous mode. pinassign2 ta b l e 9 8 u2_txd o any transmitter output for usar t2. serial transm it data. pinassign2 ta b l e 9 8 u2_rxd i any receiver inpu t for usart2. pinassign2 ta b l e 9 8 u2_rts o any request to send output for usart2. pinassign3 ta b l e 9 9 u2_cts i any clear to send input for usart2. pinassign3 ta b l e 9 9 u0_sclk i/o any serial clock input/output for usart2 in synchronous mode. pinassign3 ta b l e 9 9 table 156. usart pin description function direction pin description swm register reference
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 169 of 313 nxp semiconductors um10601 chapter 15: lpc800 usart0/1/2 u_pclk = uartclkdiv/(1+mult/div) fig 22. usart block diagram   )%&$<6((+)
769(
+=6 $(+) )%&$<6((+)
#"'6&=
+=6 $(+) )%&$<6((+) +!+6*+)
769(
+=6 $(+) +!+6*+) ,- 3 &-3 &- 
 
 +!+6*+)
;99+)
+=6 $(+) &-  &-  %;'
%(+
%&'
"#! 6&=
+&+)%(6#& &(+));5(
+&+)%(6#&
(%(;$
"#:
#&()#"
)+%
o
5%)6(d
=+&+ )%(6#&
o
'+(+!(6#&  4     <%6&
!"#!  ,
6&(+));5( -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 170 of 313 nxp semiconductors um10601 chapter 15: lpc800 usart0/1/2 15.6 register description the reset value reflects the data stored in used bits only. it does not include the content of reserved bits. table 157: register overview: usart (base address 0x4006 4000 (usart0), 0x4006 8000 (usart1), 0x4006 c000 (usart2)) name access offset description reset value reference cfg r/w 0x000 usart configuration regi ster. basic usart configuration settings that typically ar e not changed during operation. 0 table 158 ctrl r/w 0x004 usart control register. us art control settings that are more likely to change during operation. 0 table 159 stat r/w 0x008 usart status register. the complete status value can be read here. writing 1s clears some bits in the register. some bits can be cleared by writing a 1 to them. 0x000e table 160 intenset r/w 0x00c interrupt enable read and set register. contains an individual interrupt enable bit for each potential usart interrupt. a complete value may be read from this register. writing a 1 to any implemented bit position causes that bit to be set. 0 table 161 intenclr w 0x010 interrupt enable clear register. allows clearing any combination of bits in the intenset register. writing a 1 to any implemented bit position causes the corresponding bit to be cleared. - table 162 rxdata r 0x014 receiver data register. contains the last character received. - table 163 rxdatastat r 0x018 receiver data with status register. combines the last character received with the current usart receive status. allows software to recover incoming data and status together. - table 164 txdata r/w 0x01c transmit data register. data to be transmitted is written here. 0 table 165 brg r/w 0x020 baud rate generator register. 16-bit integer baud rate divisor value. 0 table 166 intstat r 0x024 interrupt status register. reflects interrupts that are currently enabled. 0x0005 table 167
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 171 of 313 nxp semiconductors um10601 chapter 15: lpc800 usart0/1/2 15.6.1 usart configuration register the cfg register contains communication and mode settings for aspects of the usart that would normally be configured once in an application. remark: if software needs to change configuration values, the following sequence should be used: 1) make sure the usart is not currently sending or receiving data. 2) disable the usart by writing a 0 to the enable bit (0 may be written to the entire register). 3) write the new configuration value, with the enable bit set to 1. table 158. usart configuration register (cfg, address 0x4006 4000 (usart0), 0x4006 8000 (usart1), 0x4006 c000 (usart2)) bit description bit symbol value description reset value 0 enable usart enable. 0 0 disabled. the usart is disabled and the internal state machine and counters are reset. while enable = 0, all usart interrupts are disabled. when enable is set again, cfg and most other control bits remain unchanged. for instance, when re-enabled, the usart will immediately generate a txrdy interrupt if enabled because the transmitter has been reset and is therefore available. 1 enabled. the usart is enabled for operation. 1 - reserved. read value is undefined, only zero should be written. na 3:2 datalen selects the data size for the usart. 00 0x0 7 bit data length. 0x1 8 bit data length. 0x2 9 bit data length. the 9th bit is commonly used for addressing in multidrop mode. see the addrdet bit in the ctrl register. 0x3 reserved. 5:4 paritysel selects what type of parity is used by the usart. 00 0x0 no parity. 0x1 reserved. 0x2 even parity. adds a bit to each character such that the number of 1s in a transmitted character is even, and the number of 1s in a received char acter is expected to be even. 0x3 odd parity. adds a bit to each character such that the number of 1s in a transmitte d character is odd, and the number of 1s in a received character is expected to be odd. 6 stoplen number of stop bits appended to transmitted data. only a single stop bit is required for received data. 0 0 1 stop bit. 1 2 stop bits. this setting should only be used for asynchronous communication. 7 - reserved. only write 0 to this bit. 8 - reserved. read value is undefined, only zero should be written. na
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 172 of 313 nxp semiconductors um10601 chapter 15: lpc800 usart0/1/2 15.6.2 usart control register the ctrl register controls aspects of usart operation that are more likely to change during operation. 9 ctsen cts enable. determines whether cts is used for flow control. cts can be from the in put pin, or from the usart?s own rts if loopback mode is enabled. see section 15.7.3 for more information. 0 0 no flow control. the transmitter does not receive any automatic flow control signal. 1 flow control enabled. the transmitter uses external or internal cts for flow control purposes. 10 - reserved. read value is undefined, only zero should be written. na 11 syncen selects synchronous or asynchronous operation. 0 0 asynchronous mode is selected. 1 synchronous mode is selected. 12 clkpol selects the clock polarity and sampling edge of received data in synchronous mode. 0 0 falling edge. un_rxd is sampled on the falling edge of sclk. 1 rising edge. un_rxd is sampled on the rising edge of sclk. 13 - reserved. read value is undefined, only zero should be written. na 14 syncmst synchronous mode master select. 0 0 slave. when synchronous mode is enabled, the usart is a slave. 1 master. when synchronous mode is enabled, the usart is a master. in asynchronous mode, the baud rate clock will be output on sclk if it is connected to a pin. 15 loop selects data loopback mode. 0 0 normal operation. 1 loopback mode. this provides a mechanism to perform diagnostic loopback testing for usart data. serial data from the transmitter (un_txd) is connected internally to serial input of the receive (un_rxd). un_txd and un_rts activity will also appear on external pins if these functions are configured to appear on device pins. the receiver rts signal is also looped back to cts and performs flow control if enabled by ctsen. 31:16 - reserved. read value is undefined, only zero should be written. na table 158. usart configuration register (cfg, address 0x4006 4000 (usart0), 0x4006 8000 (usart1), 0x4006 c000 (usart2)) bit description ?continued bit symbol value description reset value
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 173 of 313 nxp semiconductors um10601 chapter 15: lpc800 usart0/1/2 table 159. usart control register (ctrl, address 0x4006 4004 (usart0), 0x4006 8004 (usart1), 0x4006 c004 (usart2)) bit description bit symbol value description reset value 0 - reserved. read value is undefined, only zero should be written. na 1 txbrken break enable. 0 0 normal operation. 1 continuous break is sent immediately when this bit is set, and remains until this bit is cleared. a break may be sent without danger of corrupting any currently transmitting characte r if the transmitter is first disabled (txdis in ctrl is set) and then waiting for the transmitter to be disabled (txd isint in stat = 1) before writing 1 to txbrken. 2 addrdet enable address detect mode. 0 0 enabled. the usart receiver is enabled for all incoming data. 1 disabled. the usart receiver ignores incoming data that does not have the most significant bit of the data (typically the 9th bit) = 1. when the da ta msb bit = 1, the receiver treats the incoming data normally, generating a received data interrupt. software can then check the data to see if this is an address that should be handled. if it is, the addrdet bit is cleared by software and further incoming data is handled normally. 5:3 - reserved. read value is undefined, only zero should be written. na 6 txdis transmit disable. 0 0 not disabled. usart transmitter is not disabled. 1 disabled. usart transmitter is disabled after any character currently being transmitted is complete. this feature can be used to facilitate software flow control. 7 - reserved. read value is undefined, only zero should be written. na 8 cc continuous clock generation. by default, sclk is only output while data is being transmitted in synchronous mode. 0 0 clock on character. in synchronous mode, sclk cycles only when characters are being sent on un_txd or to complete a character that is being received. 1 continuous clock. sclk runs continuously in synchronous mode, allowing characters to be received on un_rxd independently from transmission on un_txd). 9 clrcc clear continuous clock. 0 0 no affect on the cc bit. 1 auto-clear. the cc bit is automatically cleared when a complete character has been received. this bit is cleared at the same time. 31:10 - reserved. read value is undefined, only zero should be written. na
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 174 of 313 nxp semiconductors um10601 chapter 15: lpc800 usart0/1/2 15.6.3 usart status register the stat register primarily provides a complete set of usart status flags for software to read. flags other than read-only flags may be cleared by writing ones to corresponding bits of stat. the error flags (for received noise, parity error, framing error, and overrun) are set immediately upon detection and remain set un til cleared by software action in stat. table 160. usart status register (stat, address 0x4006 4008 (usart0), 0x4006 8008 (usart1), 0x4006 c008(usart2)) bit description bit symbol description reset value acces s [1] 0 rxrdy receiver ready flag. when 1, indicates that data is available to be read from the receiver buffer. cleared after a read of the rxdata or rxdatastat registers. 0ro 1 rxidle receiver idle. when 0, i ndicates that the receiver is currently in the process of receiving data. when 1, indicates that the receiver is not currently in the process of receiving data. 1ro 2 txrdy transmitter ready flag. when 1, this bi t indicates that data may be written to the transmit buffer. previous data may still be in the process of being transmitted. cleared when data is written to txdata until the data is moved to the transmit shift register. 1ro 3 txidle transmitter idle. when 0, indicates that the transmitter is currently in the process of sending data.when 1, indicate that the transmitter is not currently in the process of sending data. 1ro 4 cts this bit reflects the current state of the cts signal, regardless of the setting of the ctsen bit in the cfg register. this will be the value of the cts input pin unless loopback mode is enabled. na ro 5 deltacts this bit is set when a change in the st ate is detected for the cts flag above. this bit is cleared by software. 0w1 6 txdisint transmitter disabled interrupt flag. when 1, this bit indicates that the usart transmitter is fully idle after being disabled via the txdis in the cfg register (txdis = 1). 0ro 7 - reserved. read value is undefined, only zero should be written. na na 8 overrunint overrun error interrupt flag. this flag is set when a new character is received while the receiver buffer is still in use. if this occurs, the newly received character in the shift register is lost. 0w1 9 - reserved. read value is undefined, only zero should be written. na na 10 rxbrk received break. this bit reflects the cu rrent state of the receiver break detection logic. it is set when the un_rxd pin remains low for 16 bit times. note that framerrint will also be set when this condition occurs because the stop bit(s) for the character would be missing. rxbrk is cleared when the un_rxd pin goes high. 0ro 11 deltarxbrk this bit is set when a change in the state of receiver break detection occurs. cleared by software. 0w1 12 start this bit is set when a start is detec ted on the receiver input and subsequently confirmed by a mid-bit sample. its pur pose is primarily to allow wakeup from power-down mode immediately when a star t is detected. cleared by software. 0w1
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 175 of 313 nxp semiconductors um10601 chapter 15: lpc800 usart0/1/2 [1] ro = read-only, w1 = write 1 to clear. 15.6.4 usart interrupt enable read and set register the intenset register is used to enable various usart interrupt sources. enable bits in intenset are mapped in locations that correspond to the flags in the stat register. the complete set of interrupt enables may be read from this register. writing ones to implemented bits in this register causes thos e bits to be set. the intenclr register is used to clear bits in this register. 13 framerrint framing error interrupt flag. this fl ag is set when a character is received with a missing stop bit at the expected location. this could be an indication of a baud rate or configuration mismatch with the transmitting source. 0w1 14 parityerrint parity error interrupt flag. this fl ag is set when a parity error is detected in a received character, if parity is enabled via the parity field in the cfg register. 0w1 15 rxnoiseint received noise interrupt flag. this bit is valid when there is a character to be read in the rxdata register and reflects the status of that character. three samples of received data are taken in order to determine the value of each received data bit, except in synchronous mode. this acts as a noise filter if one sample disagrees. the noise bit is set when a received data bit contains one disagreeing sample. this could indicate line noise, a baud rate or character format mismatch, or loss of synchronization during data reception. rxnoiseint is not updated during a received break. 0w1 31:16 - reserved. read value is undefined, only zero should be written. na na table 160. usart status register (stat, address 0x4006 4008 (usart0), 0x4006 8008 (usart1), 0x4006 c008(usart2)) bit description bit symbol description reset value acces s [1] table 161. usart interrupt enable read and set register (intenset, address 0x4006 400c(usart0), 0x4006 800c (usart1), 0x4006 c00c(usart2)) bit description bit symbol description reset value 0 rxrdyen when 1, enables an interrupt when there is a received character available to be read from the rxdata register. 0 1 - reserved. read value is undefined, only zero should be written. na 2 txrdyen when 1, enables an interrupt when the txdata register is available to take another character to transmit. 0 4:3 - reserved. read value is undefined, only zero should be written. na 5 deltactsen when 1, enables an interrupt when there is a change in the state of the cts input. 0 6 txdisinten when 1, enables an interrupt when the transmitter is fully disabled as indicated by the txdisint flag in stat. see description of the txdisint bit for details. 0 7 - reserved. read value is undefined, only zero should be written. na 8 overrunen when 1, enables an interrupt when an overrun error occurred. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 176 of 313 nxp semiconductors um10601 chapter 15: lpc800 usart0/1/2 15.6.5 usart interrupt enable clear register the intenclr register is used to clear bits in the intenset register. 10:9 - reserved. read value is undefined, only zero should be written. na 11 deltarxbrken when 1, enables an interrupt when a change of state has occurred in the detection of a received break condition (break condition asserted or deasserted). 0 12 starten when 1, enables an interrupt when a received start bit has been detected. 0 13 framerren when 1, enables an interrupt when a framing error has been detected. 0 14 parityerren when 1, enables an interrupt when a parity error has been detected. 0 15 rxnoiseen when 1, enables an interrupt when noise is detected. see description of the rxnoiseint bit in ta b l e 1 6 0 . 0 31:16 - reserved. read value is undefined, only zero should be written. na table 161. usart interrupt enable read and set register (intenset, address 0x4006 400c(usart0), 0x4006 800c (usart1), 0x4006 c00c(usart2)) bit description bit symbol description reset value table 162. usart interrupt enable clear register (intenclr, address 0x4006 4010(usart0), 0x4006 8010 (usart1), 0x4006 c010(usart2)) bit description bit symbol description reset value 0 rxrdyclr writing 1 clears the corresponding bit in the intenset register. 0 1 - reserved. read value is undefined, only zero should be written. na 2 txrdyclr writing 1 clears the corresponding bit in the intenset register. 0 4:3 - reserved. read value is undefined, only zero should be written. na 5 deltactsclr writing 1 clears the corresponding bit in the intenset register. 0 6 txdisintclr writing 1 clears the corresponding bit in the intenset register. 0 7 - reserved. read value is undefined, only zero should be written. na 8 overrunclr writing 1 clears the corresponding bit in the intenset register. 0 10:9 - reserved. read value is undefined, only zero should be written. na 11 deltarxbrkclr writing 1 clears the corresponding bit in the intenset register. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 177 of 313 nxp semiconductors um10601 chapter 15: lpc800 usart0/1/2 15.6.6 usart receiver data register the rxdata register contains the last character received before any overrun. remark: reading this register changes the status flags in the rxdatastat register. 15.6.7 usart receiver data with status register the rxdatastat register contains the next complete character to be read and its relevant status flags. this allows getting all information related to a received character with one 16-bit read. remark: reading this register changes the status flags. 12 startclr writing 1 clears the corresponding bit in the intenset register. 0 13 framerrclr writing 1 clears the corresponding bit in the intenset register. 0 14 parityerrclr writing 1 clears the corresponding bit in the intenset register. 0 15 rxnoiseclr writing 1 clears the corresponding bit in the intenset register. 0 31:16 - reserved. read value is undefined, only zero should be written. na table 162. usart interrupt enable clear register (intenclr, address 0x4006 4010(usart0), 0x4006 8010 (usart1), 0x4006 c010(usart2)) bit description bit symbol description reset value table 163. usart receiver data register (rxdata, address 0x4006 4014 (usart0), 0x4006 8014 (usart1), 0x4006 c014 (usart2)) bit description bit symbol description reset value 8:0 rxdat the usart receiver data register contains the next received character. the number of bits that are relevant depends on the usart configuration settings. 0 31:9 - reserved, the value read from a reserved bit is not defined. na table 164. usart receiver data with status register (rxdatastat, address 0x4006 4018 (usart0), 0x4006 8018 (usart1), 0x4006 c018 (usart2)) bit description bit symbol description reset value 8:0 rxdat the usart receiver data register contains the next received character. the number of bits t hat are relevant depends on the usart configuration settings. 0 12:9 - reserved, the value read from a reserved bit is not defined. na 13 framerr framing error status flag. this bit is valid when there is a character to be read in the rxdata register and reflects the status of that character. this bit will set when the character in rxdat was received with a missing stop bit at the expected location. this could be an indication of a baud rate or configuration mismatch with the transmitting source. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 178 of 313 nxp semiconductors um10601 chapter 15: lpc800 usart0/1/2 15.6.8 usart transmitter data register the txdata register is written in order to s end data via the usart transmitter. that data will be transferred to the transmit shift register when it is available, and another ch aracter may then be written to txdata. 14 parityerr parity error status flag. this bit is valid when there is a character to be read in the rxdata register an d reflects the status of that character. this bit will be set when a parity error is detected in a received character. 0 15 rxnoise received noise flag. see descr iption of the rxnoiseint bit in table 160 . 0 31:16 - reserved, the value read from a reserved bit is not defined. na table 164. usart receiver data with status register (rxdatastat, address 0x4006 4018 (usart0), 0x4006 8018 (usart1), 0x4006 c018 (usart2)) bit description bit symbol description reset value table 165. usart transmitter data register (txdata, address 0x4006 401c (usart0), 0x4006 801c (usart1), 0x4006 c01c (usart2)) bit description bit symbol description reset value 8:0 txdat writing to the usart transmit da ta register causes the data to be transmitted as soon as the transm it shift register is available. 0 31:9 - reserved. only zero should be written. na
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 179 of 313 nxp semiconductors um10601 chapter 15: lpc800 usart0/1/2 15.6.9 usart baud rate generator register the baud rate generator is a simple 16-bit in teger divider controlled by the brg register. the brg register contains the value used to divide the base clock in order to produce the clock used for usart internal operations. a 16-bit value allows producing standard baud rates from 300 baud and lower at the highest frequency of the device, up to 921,6 00 baud from a base clock as low as 14.7456 mhz. typically, the baud rate clock is 16 times the actual baud rate. this overclocking allows for centering the data sampling time within a bit ce ll, and for noise reduction and detection by taking three samples of incoming data. details on how to select the ri ght values for brg can be found later in this chapter, see section 15.7.1 . remark: if software needs to change the baud rate, the following sequence should be used: 1) make sure the usart is not currently sending or receiving data. 2) disable the usart by writing a 0 to the enable bit (0 may be written to the entire registers). 3) write the new brgval. 4) write to the cfg re gister to set the enable bit to 1. 15.6.10 usart interr upt status register the read-only intstat register provides a view of those interrupt flags that are currently enabled. this can simplify software handling of interrupts. see ta b l e 1 6 0 for detailed descriptions of the interrupt flags. table 166. usart baud rate generator register (brg, address 0x4006 4020 (usart0), 0x4006 8020 (usart1), 0x4006 c020 (usart2)) bit description bit symbol description reset value 15:0 brgval this value is used to divide the usart input clock to determine the baud rate, based on the input clock from the frg. 0 = the frg clock is used directly by the usart function. 1 = the frg clock is divided by 2 before use by the usart function. 2 = the frg clock is divided by 3 before use by the usart function. ... 0xffff = the frg clock is divided by 65,536 before use by the usart function. 0 31:16 - reserved. read value is undefined, only zero should be written. na table 167. usart interrupt status register (intstat, address 0x4006 4024 (usart0), 0x4006 8024 (usart1), 0x4006 c024(usart2)) bit description bit symbol description reset value 0 rxrdy receiver ready flag. 0 1 - reserved. read value is undefined, only zero should be written. na 2 txrdy transmitter ready flag. 1
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 180 of 313 nxp semiconductors um10601 chapter 15: lpc800 usart0/1/2 15.7 functional description 15.7.1 clocking and baud rates in order to use the usart, clocking details mu st be defined such as setting up the brg, and typically also setting up the frg. see figure 21 . 15.7.1.1 fractional rate generator (frg) the fractional rate generator can be used to obtain more precise baud rates when the peripheral clock is not a good multiple of standard (or otherwise desirable) baud rates. the frg is typically set up to produce an in teger multiple of the highest required baud rate, or a very close approximation. the brg is then used to obtain the actual baud rate needed. the frg register controls the usart fracti onal rate generator, which provides the base clock for the usart. th e fractional rate generator creates a lower rate output clock by suppressing selected input clocks. wh en not needed, the value of 0 can be set for the frg, which will then not divide the input clock. the frg output clock is defined as the input s clock divided by 1 + (mult / 256), where mutl is in the range of 1 to 255. this allo ws producing an output clock that ranges from the input clock divided by 1+1/256 to 1+255/256 (just more than 1 to just less than 2). any further division can be done specific to each usart block by the integer brg divider contained in each usart. 4:3 - reserved. read value is undefined, only zero should be written. na 5 deltacts this bit is set when a change in the state of the cts input is detected. 0 6 txdisint transmitter disabled interrupt flag. 0 7 - reserved. read value is undefined, only zero should be written. na 8 overrunint overrun error interrupt flag. 0 10:9 - reserved. read value is undefined, only zero should be written. na 11 deltarxbrk this bit is set when a change in the state of receiver break detection occurs. 0 12 start this bit is set when a start is detected on the receiver input. 0 13 framerrint framing e rror interrupt flag. 0 14 parityerrint parity error interrupt flag. 0 15 rxnoiseint received noise interrupt flag. 0 31:16 - reserved. read value is undefined, only zero should be written. na table 167. usart interrupt status register (intstat, address 0x4006 4024 (usart0), 0x4006 8024 (usart1), 0x4006 c024(usart2)) bit description bit symbol description reset value
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 181 of 313 nxp semiconductors um10601 chapter 15: lpc800 usart0/1/2 the base clock produced by the frg cannot be perfectly symmetrical, so the frg distributes the output clocks as evenly as is practical. since the usart normally uses 16x overclocking, the jitter in the fr actional rate clock in these ca ses tends to disappear in the ultimate usart output. for setting up the fractional divider use the following registers: table 23 ? usart fractional generator divider va lue register (uartfrgdiv, address 0x4004 80f0) bit description ? table 24 ? usart fractional generator multiplier value register (uartfrgmult, address 0x4004 80f4) bit description ? for details see section 15.3.1 ? configure the usart clock and baud rate ? . 15.7.1.2 baud rate generator (brg) the baud rate generator (see section 15.6.9 ) is used to divide the base clock to produce a rate 16 times the desired baud rate. typically, standard baud rates can be generated by integer divides of higher baud rates. 15.7.1.3 baud rate calculations base clock rates are 16x for asynchronous mode and 1x for synchronous mode. 15.7.2 synchronous mode remark: sync mode transmit and receive operate at the incoming clock rate in slave mode and the brg selected rate (not divided by 16) in master mode. 15.7.3 flow control the usart supports both hardware and software flow control. 15.7.3.1 hardware flow control the usart supports hardware flow control using rts and/or cts signalling. if rts is configured to appear on a device pin so that it can be sent to an external device, it indicates to an external device the ability of the receiver to receive more data. it can also be used internally to throttle the transmitte r from the receiver, which can be especially useful if loopback mode is enabled. if connected to a pin, and if enabled to do so , the cts input can allow an external device to throttle the usart transmitte r. both internal and external cts can be used separately or together. figure 23 shows an overview of rts and cts within the usart.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 182 of 313 nxp semiconductors um10601 chapter 15: lpc800 usart0/1/2 15.7.3.2 software flow control software flow control could include xon / xo ff flow control, or ot her mechanisms. these are supported by the ability to check the current st ate of the cts inpu t, and/or have an interrupt when cts changes state (via the ct s and deltacts bits, respectively, in the stat register), and by the abilit y of software to gracefully tu rn off the transmitter (via the txdis bit in the ctrl register). fig 23. hardware flow control using rts and cts )%&$<6((+) +!+6*+)  . 1 &-  &-  !7%&=+
'+(+!(   . 1   .  1  .1 , 
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 183 of 313 16.1 how to read this chapter the i2c-bus interface is available on all parts. read this chapter if you want to understand the i2c operation and the software interface and want to learn how to use the i2c for wake-up from reduced power modes. the lpc800 provides an on-chip rom-based i2c api to configure and operate the i2c. see ta b l e 2 5 0 ? i2c api calls ? . 16.2 features ? independent master, slave, and monitor functions. ? supports both multi-master and multi-master with slave functions. ? multiple i 2 c slave addresses supported in hardware. ? one slave address can be selectively qualified with a bit mask or an address range in order to respond to multiple i 2 c bus addresses. ? 10-bit addressing supported with software assist. ? supports smbus. 16.3 basic configuration configure i2c using th e following registers: ? in the sysahbclkctrl register, set bit 5 ( table 18 ) to enable the clock to the register interface. ? clear the i2c peripheral reset using the presetctrl register ( ta b l e 7 ). ? enable/disable the i2c interrupt in in terrupt slots #8 in the nvic. ? configure the i2c pin functions through the switch matrix. see section 16.4 . ? the peripheral clock for the i2c is the system clock (see figure 24 ). um10601 chapter 16: lpc800 i2c-bus interface rev. 1.0 ? 7 november 2012 preliminary user manual fig 24. i2c clocking "#!
'6*6'+)   $d$(+<
!"#!    .81 a
!"#!
+&%c"+b - 44 4 
!"#!
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 184 of 313 nxp semiconductors um10601 chapter 16: lpc800 i2c-bus interface 16.4 pin description the i2c pins are movable pin functions and are assigned to pins on the lpc800 packages through the switch matrix. you hav e two choices to connect the i2c pins: 1. connect to special i2c open-drain pins (pio0_10 and pio0_11). 2. connect to any other pin that can host a movable function.. when the i 2 c function is connected to specialized i 2 c pins, it completely supports the i 2 c-bus specification up to fast mode plus (up to 1 mhz i 2 c). when the i 2 c function is connected to standard pins that are set to open-drain mode, a functional i 2 c-bus can be used in this way, but some aspects of the i 2 c-bus specification may not be met. this can have an impact on the bus speed, noise filtering, and the capability of powering down the de vice without affecting the bus. see section 9.3.1 ? connect an internal signal to a package pin ? to assign the i2c pins to any pin on the lpc800 package. 16.5 general description the architecture of the i2c-bus interface is shown in figure 25 . table 168. i2c-bus pin description function type pin description swm register reference i2c0_scl i/o any; use pin pio0_10 or pio0_11 for compatibility with the full i2c-bus specification. i2c0 serial clock. pinassign8 table 104 i2c0_sda i/o any; use pin pio0_10 or pio0_11 for compatibility with the full i2c-bus specification. i2c0 serial data. pinassign7 table 103
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 185 of 313 nxp semiconductors um10601 chapter 16: lpc800 i2c-bus interface 16.6 register description the register functionalities can be grouped as follows: ? common registers: ? ta b l e 1 7 0 ? i2c configuration register (cfg, ad dress 0x4005 0000) bit description ? ? ta b l e 1 7 1 ? i 2 c status register (stat, address 0x4005 0004) bit description ? ? ta b l e 1 7 8 ? i 2 c interrupt status register (intstat, address 0x4005 0018) bit description ? ? ta b l e 1 7 4 ? interrupt enable set and read register (intenset, address 0x4005 0008) bit description ? ? ta b l e 1 7 5 ? interrupt enable clear register (i ntenclr, address 0x4005 000c) bit description ? ? ta b l e 1 7 6 ? time-out register (timeout, address 0x4005 0010) bit description ? ? ta b l e 1 7 7 ? i 2 c clock divider register (div, address 0x4005 0014) bit description ? ? master function registers: ? ta b l e 1 7 9 ? master control register (mstctl, address 0x4005 0020) bit description ? ? ta b l e 1 8 0 ? master time register (msttime, address 0x4005 0024) bit description ? fig 25. i2c block diagram 6<+#;(   
<%$(+)
9;&!(6#&   
$"%*+
9;&!(6#& ,- ,- 
o

#;(5;(
"#=6 ! 6<6&=
=+&+ )%(6#& # $ # $ .1 #&6(#)
9;&!(6#&
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 186 of 313 nxp semiconductors um10601 chapter 16: lpc800 i2c-bus interface ? ta b l e 1 8 1 ? master data register (mstdat, address 0x4005 0028) bit description ? ? slave function registers: ? ta b l e 1 8 2 ? slave control register (slvctl, address 0x4005 0040) bit description ? ? ta b l e 1 8 2 ? slave control register (slvctl, address 0x4005 0040) bit description ? ? ta b l e 1 8 4 ? slave address registers (slva dr[0:3]- address 0x4005 0048 (slvadr0) to 0x4005 0054 (slvadr3)) bit description ? ? ta b l e 1 8 5 ? slave address qualifier 0 register (slvqual0, address 0x4005 0058) bit description ? ? monitor function register: table 186 ? monitor data register (monrxdat, address 0x4005 0080) bit description ?
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 187 of 313 nxp semiconductors um10601 chapter 16: lpc800 i2c-bus interface 16.6.1 i2c configuration register the cfg register contains mode settings that apply to master, slave, and monitor functions. table 169: register overview: i2c (base address 0x4005 0000) name access offset description reset value reference cfg r/w 0x00 configuration for shared functions. 0 table 170 stat r/w 0x04 status register for master, slave, and monitor functions. 0x00080 1 table 171 intenset r/w 0x08 interrupt enable set and read register. 0 table 174 intenclr w 0x0c interrupt enable clear register. na table 175 timeout r/w 0x10 time-out value register. 0xffff table 176 div r/w 0x14 clock pre-divider for the entire i 2 c block. this determines what time increments are used for the msttime and slvtime registers. 0 table 177 intstat r 0x18 interrupt status regist er for master, slave, and monitor functions. 0 table 178 mstctl r/w 0x20 master control register. 0 table 179 msttime r/w 0x24 master timing configuration. 0x77 table 180 mstdat r/w 0x28 combined master receiver and transmitter data register. na table 181 slvctl r/w 0x40 slave control register. 0 table 182 slvdat r/w 0x44 combined slave receiver and transmitter data register. na table 183 slvadr0 r/w 0x48 slave address 0. 0x01 table 184 slvadr1 r/w 0x4c slave address 1. 0x01 table 184 slvadr2 r/w 0x50 slave address 2. 0x01 table 184 slvadr3 r/w 0x54 slave address 3. 0x01 table 184 slvqual0 r/w 0x58 slave qualification for address 0. 0 table 185 monrxdat ro 0x80 monitor receiver data register. 0 table 186 table 170. i2c configuration register (cfg, address 0x4005 0000) bit description bit symbol value description reset value 0 msten master enable. when disabl ed, configurations settings for the master function are no t changed, but the master function is internally reset. 0 0 disabled. the i 2 c master function is disabled. 1 enabled. the i 2 c master function is enabled. 1 slven slave enable. when disabled, configurations settings for the slave function are not changed, but the slave function is internally reset. 0 0 disabled. the i 2 c slave function is disabled. 1 enabled. the i 2 c slave function is enabled.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 188 of 313 nxp semiconductors um10601 chapter 16: lpc800 i2c-bus interface 2 monen monitor enable. when disabled, configurations settings for the monitor function are not changed, but the monitor function is internally reset. 0 0 disabled. the i 2 c monitor function is disabled. 1 enabled. the i 2 c monitor function is enabled. 3 timeouten i 2 c bus time-out enable. when disabled, time-out flags will be automatically cleared. 0 0 disabled. time-out function is disabled. 1 enabled. time-out function is enabled. both types of time-out flags will be generated and will cause interrupts if they are enabled. typically, only one time-out will be used in a system. 4 monclkstr monitor function clock stretching. 0 0 disabled. the monitor function will not perform clock stretching. software may not always be able to read data provided by the monitor function before it is overwritten. this mode may be used when non-invasive monitoring is critical. 1 enabled. the monitor function will perform clock stretching in order to ensure that software can read all incoming data supplied by the monitor function. 31:5 - reserved. read value is undefined, only zero should be written. na table 170. i2c configuration register (cfg, address 0x4005 0000) bit description bit symbol value description reset value
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 189 of 313 nxp semiconductors um10601 chapter 16: lpc800 i2c-bus interface 16.6.2 i2c status register the stat register provides status flags and st ate information about all of the functions of the i 2 c block. some information in this register is read-only, some flags can be cleared by writing a 1 to them. access to bits in this register varies . ro = read-only, w1 = write 1 to clear. details on the master and slave states described in the mststate and slvstate bits in this register are listed in table 172 and table 173 . table 171. i 2 c status register (stat, address 0x4005 0004) bit description bit symbol value description reset value acce ss 0 mstpending master pending. indicates whether the master function needs software service. this flag will cause an interrupt when set if enabled via the intenset register. the mstpending flag is automatically cleared when a 1 is written to the mstcontinue bit in the mstctl register. 1ro 0 no service needed. the master functi on does not currently need service. 1 service needed. the master function needs service. information on what is needed can be found in the adjacent mststate field. 3:1 mststate master state code. each value of this field indicates a specific required service for the master function. all other values are reserved. 0ro 0x0 idle. the master function is avail able to be used for a new transaction. 0x1 receive ready. received data available (master receiver mode). address plus read was previously sent and acknowledged by slave. 0x2 transmit ready. data can be transmitted (master transmitter mode). address plus write was previously sent and acknowledged by slave. 0x3 address. slave nacked address. 0x4 data. slave nacked transmitted data. 4 mstarbloss master arbitration loss flag. this flag can be cleared by software writing a 1 to this bit. it is also clear ed automatically a 1 is written to mstcontinue. 0w1 0 no loss. no arbitration loss has occurred. 1 arbitration loss. the master func tion has experienced an arbitration loss. at this point, the master function has already stopped driving the bus and gone to an idle state. software can respond by doing nothing, or by sending a start in order to attempt to gain control of the bus when it next becomes idle. 5 - reserved. read value is undefined, only zero should be written. na na 6 mstststperr master start/stop error flag. this flag can be cleared by software writing a 1 to this bit. it is also clear ed automatically a 1 is written to mstcontinue. 0w1 0 no start/stop error has occurred. 1 start/stop error has occurred. the master function has experienced a start/stop error. a start or stop was detected at a time when it is not allowed by the i 2 c specification. the master interfac e has stopped driving the bus and gone to an idle state, no action is requi red. a request for a start could be made, or software could attempt to insure that the bus has not stalled.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 190 of 313 nxp semiconductors um10601 chapter 16: lpc800 i2c-bus interface 7 - reserved. read value is undefined, only zero should be written. na na 8 slvpending slave pending. indicates whet her the slave functi on needs software service. this flag will cause an interrupt when set if enabled via intenset. the slvpending flag is read-only and is automatically cleared when a 1 is written to the slvcontinue bit in the mstctl register. 0ro 0 no service needed. the slave function does not currently need service. 1 service needed. the slave function needs service. information on what is needed can be found in the adjacent slvstate field. 10:9 slvstate slave state code. each value of this field indicates a specific required service for the slave function. all other values are reserved. 0ro 0x0 received. address plus r/w receiv ed. at least one of the four slave addresses has been matched by hardware. 0x1 data available. received data is available (slave receiver mode). 0x2 data ready for transmit. data can be transmitted (slave transmitter mode). 0x3 reserved. 11 slvnotstr slave not stretching. indicates when the slave function is stretching the i 2 c clock. this is needed in order to gracefully invoke deep sleep or power-down modes during slave operat ion. this read-only flag reflects the slave function status in real time. 1ro 0 stretching. the slave function is currently stretching the i 2 c bus clock. deep-sleep or power-down mode cannot be entered at this time. 1 not stretching. the slave function is not currently stretching the i 2 c bus clock. deep-sleep or power-down mode could be entered at this time. 13:12 slvidx slave address match index. this field is valid when the i 2 c slave function has been selected by receiving an address that matches one of the slave addresses defined by any enabled slav e address registers, and provides an identification of the address that was matched. it is possible that more than one address could be matched, but only one match can be reported here. 0ro 0x0 slave address 0 was matched. 0x1 slave address 1 was matched. 0x2 slave address 2 was matched. 0x3 slave address 3 was matched. 14 slvsel slave selected flag. slvsel is set after an address match when software tells the slave function to acknowledge the address. it is cleared when another address cycle present s an address that does not match an enabled address on the slave function, when slave software decides to nack a matched address, or when there is a stop detected on the bus. slvsel is not cleared if software nacks data. 0ro 0 not selected. the slave func tion is not currently selected. 1 selected. the slave function is currently selected. table 171. i 2 c status register (stat, address 0x4005 0004) bit description ?continued bit symbol value description reset value acce ss
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 191 of 313 nxp semiconductors um10601 chapter 16: lpc800 i2c-bus interface 15 slvdesel slave deselected flag. this flag will cause an interrupt when set if enabled via intenset. this flag can be cleared by writing a 1 to this bit. 0w1 0 not deselected. the slave function has not become deselected. this does not mean that it is currently se lected. that information can be found in the slvsel flag. 1 deselected. the slave function has become deselected. this is specifically caused by the slvsel fl ag changing from 1 to 0. see the description of slvsel for details on when that event occurs. 16 monrdy monitor ready. this flag is cl eared when the monrxdat register is read. 0ro 0 no data. the monitor function does not currently have data available. 1 data waiting. the monitor functi on has data waiting to be read. 17 monov monitor overflow flag. 0 w1 0 no overrun. monitor data has not overrun. 1 overrun. a monitor data overrun has occurred. this can only happen when monitor clock stretching not enabled via the monclkstr bit in the cfg register. writing 1 to this bit clears the flag. 18 monactive monitor active flag. this fl ag indicates when the monitor function considers the i 2 c bus to be active. active is defined here as when some master is on the bus: a bus start has occurred more rece ntly than a bus stop. 0ro 0 inactive. the monitor function considers the i 2 c bus to be inactive. 1 active. the monitor function considers the i 2 c bus to be active. 19 monidle monitor idle flag. this flag is set when the monitor function sees the i 2 c bus change from active to inactive. this can be used by software to decide when to process data accumulated by the monitor function. this flag will cause an interrupt when set if enabled via the intenset register . the flag can be cleared by writing a 1 to this bit. 0w1 0not idle. the i 2 c bus is not idle, or this flag has been cleared by software. 1 idle. the i 2 c bus has gone idle at least once since the last time this flag was cleared by software. 23:20 - reserved. read value is undefined, only zero should be written. na na 24 eventtimeout event time-out in terrupt flag. indicates when the time between events has been longer than the time specified by the timeout register. events include start, stop, and clock edges. the case of scl remaining low longer than timeout is not reported by this flag, it is reported in by the scl time-out flag. the flag is cleared by writing a 1 to this bit. 0w1 0 no time-out. i 2 c bus events have not caused a time-out. 1 event time-out. the time between i 2 c bus events has been longer than the time specified by t he i2c timeout register. 25 scltimeout scl time-out interrupt flag. indicates when scl has remained low longer than the time specific by the timeout register. the flag is cleared by writing a 1 to this bit. 0w1 0 no time-out. scl low time has not caused a time-out. 1 time-out. scl low time has caused a time-out. 31:26 - reserved. read value is undefined, only zero should be written. na na table 171. i 2 c status register (stat, address 0x4005 0004) bit description ?continued bit symbol value description reset value acce ss
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 192 of 313 nxp semiconductors um10601 chapter 16: lpc800 i2c-bus interface table 172: master function state codes (mststate) mststate description actions 0 idle. the master function is available to be used for a new transaction. send a start or disable mstpending interrupt if the master function is not needed currently. 1 received data is available (master receiver mode). address plus read was previously sent and acknowledged by slave. read data and either continue, send a stop, or send a repeated start. 2 data can be transmitted (master transmitter mode). address plus write was previous ly sent and acknowledged by slave. send data and continue, or send a stop or repeated start. 3 slave nacked address. send a stop or repeated start. 4 slave nacked transmitted data. send a stop or repeated start. table 173: slave function state codes (slvstate) slvstate description actions 0 address plus r/w received. at least one of the 4 slave addresses has been matched by hardware. software can further check the address if needed, for instance if a subset of addresses qualified by slvqual0 is to be used. software can ack or nack the address by writing 1 to either slvconti nue or slvnack. also see section 16.7.3 regarding 10-bit addressing. 1 received data is available (slave receiver mode). read data reply with an ack or a nack. 2 data can be transmitted (slave transmitter mode). send data. 3 reserved. -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 193 of 313 nxp semiconductors um10601 chapter 16: lpc800 i2c-bus interface 16.6.3 interrupt enable set and read register the intenset register controls which i 2 c status flags generate interrupts. writing a 1 to a bit position in this register enables an interr upt in the corresponding position in the stat register, if an interrupt is supported there. reading intenset indicates which interrupts are currently enabled. table 174. interrupt enable set and read register (intenset, address 0x4005 0008) bit description bit symbol value description reset value 0 mstpendingen master pend ing interrupt enable. 0 0 the mstpending interrupt is disabled. 1 the mstpending interrupt is enabled. 3:1 - reserved. read value is undefined, only zero should be written. na 4 mstarblossen master arbitrat ion loss interrupt enable. 0 0 the mstarbloss interrupt is disabled. 1 the mstarbloss interrupt is enabled. 5 - reserved. read value is undefined, only zero should be written. na 6 mstststperren master start/sto p error interrupt enable. 0 0 the mstststperr interrupt is disabled. 1 the mstststperr interrupt is enabled. 7 - reserved. read value is undefined, only zero should be written. na 8 slvpendingen slave pending interrupt enable. 0 0 the slvpending interrupt is disabled. 1 the slvpending interrupt is enabled. 10:9 - reserved. read value is undefined, only zero should be written. na 11 slvnotstren slave not stre tching interrupt enable. 0 0 the slvnotstr interrupt is disabled. 1 the slvnotstr interrupt is enabled. 14:12 - reserved. read value is undefined, only zero should be written. na 15 slvdeselen slave deselect interrupt enable. 0 0 the slvdesel interrupt is disabled. 1 the slvdesel interrupt is enabled. 16 monrdyen monitor data ready interrupt enable. 0 0 the monrdy interrupt is disabled. 1 the monrdy interrupt is enabled. 17 monoven monitor overrun interrupt enable. 0 0 the monov interrupt is disabled. 1 the monov interrupt is enabled. 18 - reserved. read value is undefined, only zero should be written. na
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 194 of 313 nxp semiconductors um10601 chapter 16: lpc800 i2c-bus interface 16.6.4 interrupt enable clear register writing a 1 to a bit position in intenclr clears the corresponding position in the intenset register, disabling that interr upt. intenclr is a wr ite-only register. bits that do not correspond to defined bits in intenset are reserved and only zeroes should be written to them. 19 monidleen monitor idle interrupt enable. 0 0 the monidle interrupt is disabled. 1 the monidle interrupt is enabled. 23:20 - reserved. read value is undefined, only zero should be written. na 24 eventtimeouten event time -out interrupt enable. 0 0 the event time-out interrupt is disabled. 1 the event time-out interrupt is enabled. 25 scltimeouten scl time-out interrupt enable. 0 0 the scl time-out interrupt is disabled. 1 the scl time-out interrupt is enabled. 31:26 - reserved. read value is undefined, only zero should be written. na table 174. interrupt enable set and read register (intenset, address 0x4005 0008) bit description bit symbol value description reset value table 175. interrupt enable clear regist er (intenclr, address 0x4005 000c) bit description bit symbol description reset value 0 mstpendingclr master pending interrupt clear. writing 1 to this bit clears the corresponding bit in the intenset register if implemented. 0 3:1 - reserved. read value is undefined, only zero should be written. na 4 mstarblossclr master arbitration loss interrupt clear. 0 5 - reserved. read value is undefined, only zero should be written. na 6 mstststperrclr master start/stop error interrupt clear. 0 7 - reserved. read value is undefined, only zero should be written. na 8 slvpendingclr slave pending interrupt clear. 0 10:9 - reserved. read value is undefined, only zero should be written. na 11 slvnotstrclr slave not st retching interrupt clear. 0 14:12 - reserved. read value is undefined, only zero should be written. na
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 195 of 313 nxp semiconductors um10601 chapter 16: lpc800 i2c-bus interface 16.6.5 time-out value register the timeout register allows setting an upper limit to certain i 2 c bus times, informing by status flag and/or interrupt when those times are exceeded. two time-outs are generated, software can elect to use ei ther of them. eventtimeout checks the time between bus events while the bus is not idle: start, scl rising, scl falling, and stop. the eventtimeout status flag in the stat register is set if the time between any two events becomes longer than the time configured in the timeout register. the eventtimeout status flag can ca use an interrup t if enabled to do so by the eventtimeouten bit in the intenset register. scltimeout checks only the time that the scl signal remains low, while the bus is not idle. the scltimeout status flag in the stat register is set if sc l remains low longer than the time configured in the timeout register. the scltimeout status flag can cause an interrupt if enabled to do so by the scltimeouten bit in the intenset register. also see section 16.7.2 ? time-out ? . 15 slvdeselclr slave deselect interrupt clear. 0 16 monrdyclr monitor data ready interrupt clear. 0 17 monovclr monitor overrun interrupt clear. 0 18 - reserved. read value is undefined, only zero should be written. na 19 monidleclr monitor idle interrupt clear. 0 23:20 - reserved. read value is undefined, only zero should be written. na 24 eventtimeoutclr event time -out interrupt clear. 0 25 scltimeoutclr scl time-out interrupt clear. 0 31:26 - reserved. read value is undefined, only zero should be written. na table 175. interrupt enable clear regist er (intenclr, address 0x4005 000c) bit description ?continued bit symbol description reset value
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 196 of 313 nxp semiconductors um10601 chapter 16: lpc800 i2c-bus interface 16.6.6 i2c clock divider register the clkdiv register divides down the pe ripheral clock (pclk) to produce the i 2 c function clock that is used to time various aspects of the i 2 c interface. the i 2 c function clock is used for some internal operations in the i 2 c block and to generate the timing required by the i 2 c bus specification, some of which are user configured in the msttime register for master operation and the slvtime register for slave operation. see section 16.7.1.1 ? rate calculations ? for details on bus rate setup. 16.6.7 i2c interrupt status register the intstat register provides register provid es a view of those interrupt flags that are currently enabled. this can simplify software handling of interrupts. see ta b l e 1 7 1 for detailed descriptions of the interrupt flags. table 176. time-out register (timeout , address 0x4005 0010) bit description bit symbol description reset value 3:0 tomin time-out time value, bottom f our bits. these are hard-wired to 0xf. this gives a minimu m time-out of 16 i 2 c function clocks and also a time-out resolution of 16 i 2 c function clocks. 0xf 15:4 to time-out time value. specifies the time-out interval value in increments of 16 i 2 c function clocks, as defined by the clkdiv register. to change this value while i 2 c is in operation, disable all time-outs, write a new value to timeout, then re-enable time-outs. 0x000 = a time-out will occur after 16 counts of the i 2 c function clock. 0x001 = a time-out will occur after 32 counts of the i 2 c function clock. ... 0xfff = a time-out will occur after 65,536 counts of the i 2 c function clock. 0xfff 31:16 - reserved. read value is undefi ned, only zero should be written. na table 177. i 2 c clock divider register (div, address 0x4005 0014) bit description bit symbol description reset value 15:0 divval this field controls how the clock (pclk) is used by the i 2 c functions that need an internal clock in order to operate. 0x0000 = pclk is used directly by the i 2 c function. 0x0001 = pclk is divided by 2 before use by the i 2 c function. 0x0002 = pclk is divided by 3 before use by the i 2 c function. ... 0xffff = pclk is divided by 65,536 before use by the i 2 c function. 0 31:16 - reserved. read value is undefined, only zero should be written. na
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 197 of 313 nxp semiconductors um10601 chapter 16: lpc800 i2c-bus interface 16.6.8 master control register the mstctl register contains bits t hat control various functions of the i 2 c master interface. table 178. i 2 c interrupt status register (intstat, address 0x4005 0018) bit description bit symbol description reset value 0 mstpending master pending. 1 3:1 - reserved. 4 mstarbloss master arbitration loss flag. 0 5 - reserved. read value is undefined, only zero should be written. na 6 mstststperr master start/stop error flag. 0 7 - reserved. read value is undefined, only zero should be written. na 8 slvpending slave pending. 0 10:9 - reserved. read value is undefined, only zero should be written. na 11 slvnotstr slave not stretching status. 1 14:12 - reserved. read value is undefined, only zero should be written. na 15 slvdesel slave deselected flag. 0 16 monrdy monitor ready. 0 17 monov monitor overflow flag. 0 18 - reserved. read value is undefined, only zero should be written. na 19 monidle monitor idle flag. 0 23:20 - reserved. read value is undefined, only zero should be written. na 24 eventtimeout event time -out interrupt flag. 0 25 scltimeout scl time-out interrupt flag. 0 31:26 - reserved. read value is undefined, only zero should be written. na table 179. master control register (mstctl, address 0x4005 0020) bit description bit symbol value description reset value 0 mstcontinue master continue . this bit is write-only. 0 0 no effect. 1 continue. informs the master function to continue to the next operation. this must done after writing transmit data, reading received data, or any other housekeeping related to the next bus operation. 1 mststart master start control. this bit is write-only. 0 0 no effect. 1 start. a start will be generated on the i 2 c bus at the next allowed time.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 198 of 313 nxp semiconductors um10601 chapter 16: lpc800 i2c-bus interface 16.6.9 master time the msttime register allows programming of certain times that may be controlled by the master function. these include the clock (scl ) high and low times, repeated start setup time, and transmitted data setup time. the i2c clock pre-divider is described in ta b l e 1 7 7 . 2 mststop master stop control. this bit is write-only. 0 0 no effect. 1 stop. a stop will be generated on the i 2 c bus at the next allowed time, preceded by a nack to the slave if the master is receiving data from the slave (master receiver mode). 31: 2 - reserved. read value is undefined, only zero should be written. na table 179. master control register (mstctl, address 0x4005 0020) bit description bit symbol value description reset value table 180. master time register (msttime, address 0x4005 0024) bit description bit symbol value description reset value 2:0 mstscllow master scl low time. specifies the minimum low time that will be asserted by this master on scl. other devices on the bus (masters or slaves) could lengthen this time. this corresponds to the parameter t low in the i 2 c bus specification. i 2 c bus specification parameters t buf and t su;sta have the same values and are also controlled by mstscllow. 0 0x0 2 clocks. minimum scl low time is 2 clocks of the i 2 c clock pre-divider. 0x1 3 clocks. minimum scl low time is 3 clocks of the i 2 c clock pre-divider. 0x2 4 clocks. minimum scl low time is 4 clocks of the i 2 c clock pre-divider. 0x3 5 clocks. minimum scl low time is 5 clocks of the i 2 c clock pre-divider. 0x4 6 clocks. minimum scl low time is 6 clocks of the i 2 c clock pre-divider. 0x5 7 clocks. minimum scl low time is 7 clocks of the i 2 c clock pre-divider. 0x6 8 clocks. minimum scl low time is 8 clocks of the i 2 c clock pre-divider. 0x7 9 clocks. minimum scl low time is 9 clocks of the i 2 c clock pre-divider.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 199 of 313 nxp semiconductors um10601 chapter 16: lpc800 i2c-bus interface 16.6.10 master data register the mstdat register provides the means to read the most recently received data for the master function, and to transmi t data using the master function. 16.6.11 slave control register the slvctl register contains bits th at control various functions of the i 2 c slave interface. 6:4 mstsclhigh master scl high time. specifies the minimum high time that will be asserted by this master on scl. other masters in a multi-master system could shorten this time. this corresponds to the parameter t high in the i 2 c bus specification. i 2 c bus specification parameters t su;sto and t hd;sta have the same values and are also controlled by mstsclhigh. 0 0x0 2 clocks. minimum scl high time is 2 clock of the i 2 c clock pre-divider. 0x1 3 clocks. minimum scl high time is 3 clocks of the i 2 c clock pre-divider . 0x2 4 clocks. minimum scl high time is 4 clock of the i 2 c clock pre-divider. 0x3 5 clocks. minimum scl high time is 5 clock of the i 2 c clock pre-divider. 0x4 6 clocks. minimum scl high time is 6 clock of the i 2 c clock pre-divider. 0x5 7 clocks. minimum scl high time is 7 clock of the i 2 c clock pre-divider. 0x6 8 clocks. minimum scl high time is 8 clock of the i 2 c clock pre-divider. 0x7 9 clocks. minimum scl high time is 9 clocks of the i 2 c clock pre-divider. 31:7 - reserved. read value is undefined, only zero should be written. na table 180. master time register (msttime, address 0x4005 0024) bit description ?continued bit symbol value description reset value table 181. master data register (mstdat, address 0x4005 0028) bit description bit symbol description reset value 7:0 data master function data register. read: read the most recently received data for the master function. write: transmit data using the master function . 0 31:8 - reserved. read value is undefined, only zero should be written. na
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 200 of 313 nxp semiconductors um10601 chapter 16: lpc800 i2c-bus interface 16.6.12 slave data register the slvdat register provides the means to read the most recently received data for the slave function and to transmit data using the slave function. table 182. slave control register (slvct l, address 0x4005 0040) bit description bit symbol value description reset value 0 slvcontinue slave continue. 0 0 no effect. 1 continue. informs the slave func tion to continue to the next operation. this must done after writing transmit data, reading received data, or any other housekeeping related to the next bus operation. 1 slvnack slave nack. 0 0 no effect. 1 nack. causes the slave functi on to nack the master when the slave is receiving data from the master (slave receiver mode). 31:2 - reserved. read value is undefined, only zero should be written. na table 183. slave data register (slvdat, address 0x4005 0044) bit description bit symbol description reset value 7:0 data slave function data register. read: read the most recently received data for the slave function. write: transmit data using the slave function . 0 31:8 - reserved. read value is undefined, only zero should be written. na
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 201 of 313 nxp semiconductors um10601 chapter 16: lpc800 i2c-bus interface 16.6.13 slave address registers the slvadr[0:3] registers allow enabling and defining one of the add resses that can be automatically recognized by the i 2 c slave hardware. the value in the slvadr0 register is qualified by the setting of the slvqual0 register. when the slave address is compared to the rece ive address, the compare can be affected by the setting of the slvqual0 register (see section 16.6.14 ). the i 2 c slave function has 4 addr ess comparators. the additi onal 3 address comparators do not include the address qualifier feature. for handling of the general call address, one of the 4 address registers can be programmed to respond to address 0. 16.6.14 slave address qualifier 0 register the slvqual0 register can alter how slave address 0 is interpreted. table 184. slave address registers (slvadr[0:3]- address 0x4005 0048 (slvadr0) to 0x4005 0054 (slvadr3)) bit description bit symbol value description reset value 0 sadisable slave address n disable. 1 0 enabled. slave address n is enabled and will be recognized with any changes specified by the slvqual0 register. 1 ignored slave address n is ignored. 7:1 slvadr seven bit slave address that is compared to received addresses if enabled. 0 31:8 - reserved. read value is undefined, only zero should be written. na
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 202 of 313 nxp semiconductors um10601 chapter 16: lpc800 i2c-bus interface 16.6.15 monitor data register the read-only monrxdat register provid es information about events on the i 2 c bus, primarily to facilitat e debugging of the i 2 c during application development. all data addresses and data passing on the bus and whether these were acknowledged, as well as start and stop events, are reported. the monitor function must be enabled by the monen bit in the cfg register. monitor mode can be configured to stretch the i 2 c clock if data is not read from the monrxdat register in time to prevent it, via the monclkstr bit in the cfg register . this can help ensure that nothing is missed but can cause t he monitor function to be somewhat intrusive (by potentially adding clock delays, depending on software response time). in order to improve the chance of collecting all monitor info rmation if clock stretching is not enabled, monitor data is buffered such that it is available until the end of the next piece of information from the i 2 c bus. table 185. slave address qualifier 0 regist er (slvqual0, address 0x4005 0058) bit description bit symbol value description reset value 0 qualmode0 reserved. read value is undefined, only zero should be written. 0 0 the slvqual0 field is used as a logical mask for matching address 0. 1 the slvqual0 field is used to extend address 0 matching in a range of addresses. 7:1 slvqual0 slave address qualifier for address 0. a value of 0 causes the address in slvadr0 to be used as-is, assuming that it is enabled. if qualmode0 = 0, any bit in this field which is set to 1 will cause an automatic match of the corresponding bit of the received address when it is compared to the slvadr0 register. if qualmode0 = 1, an address range is matched for address 0. this range extend s from the value defined by slvadr0 to the address defined by slvqual0 (address matches when slvadr0[7:1] <= received address <= slvqual0[7:1]). 0 31:8 - reserved. read value is undefined, only zero should be written. na table 186. monitor data register (monrxdat, address 0x4005 0080) bit description bit symbol value description reset value 7:0 monrxdat monitor function receiver data. this reflects every data byte that passes on the i 2 c pins, and adds indication of start, repeated start, and data nack. 0 8 monstart monitor received start. 0 0 no detect. the monitor function has not detected a start event on the i 2 c bus. 1 start detect. the monitor function has detected a start event on the i 2 c bus.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 203 of 313 nxp semiconductors um10601 chapter 16: lpc800 i2c-bus interface 16.7 functional description 16.7.1 bus rates and timing considerations due to the natu re of the i 2 c bus, it is generally not possib le to guarantee a specific clock rate on the scl pin. the clock can be st retched by any slave device, extended by software overhead time, etc. in a multi-mast er system, the master that provides the shortest scl high time will cause that time to appear on scl as lo ng as that master is participating in i2c traffic (i.e. when it is the only master on the bus, or during arbitration between masters). rate calculations give a base frequency that represents the fastest that the i 2 c bus could operate if nothing slows it down. 16.7.1.1 rate calculations scl high time (in i 2 c function clocks) = (clkdiv + 1) * (mstsclhigh + 2) scl low time (in i 2 c function clocks) = (clkdiv + 1) * (mstscllow + 2) nominal scl rate = i 2 c function clock rate / (scl high time + scl low time) 16.7.2 time-out a time-out feature on an i 2 c interface can be used to detect a ?stuck? bus and potentially do something to alleviate th e condition. two different types of time-out are supported. both types apply whenever the i 2 c block and the time-out function are both enabled, master, slave, or monitor functions do not need to be enabled. in the first type of ti me-out, reflected by th e eventtimeout flag in the stat register, the time between bus events governs the time-out check. these events include start, stop, and all changes on the i 2 c clock (scl). this time-out is asserted when the time between 9 monrestart monitor received repeated start. 0 0 no start detect. the monitor function has not detected a repeated start event on the i 2 c bus. 1 repeated start detect. the monitor function has detected a repeated start event on the i 2 c bus. 10 monnack monitor received nack. 0 0 acknowledged. the data currently being provided by the monitor function was acknowledged by at least one master or slave receiver. 1 not acknowledged. the data currently being provided by the monitor function was not acknowledged by any receiver. 31:11 - reserved. read value is undefined, only zero should be written. na table 186. monitor data register (monrxdat, address 0x4005 0080) bit description bit symbol value description reset value
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 204 of 313 nxp semiconductors um10601 chapter 16: lpc800 i2c-bus interface any of these events is longer than the time configured in the timeout register. this time-out could be useful in monitoring an i 2 c bus within a system as part of a method to keep the bus running of problems occur. the second type of i 2 c time-out is reflected by the scltimeout flag in the stat register. this time-out is asserted when th e scl signal remains low longer than the time configured in the timeout register. this corresponds to smbus time-out parameter t timeout . in this situation, a slave could reset its own i 2 c interface in case it is the offending device. if all listening slaves (inc luding masters that can be addressed as slaves) do this, then the bus will be releas ed unless it is a current master causing the problem. refer to the smbus s pecification for more details. both types of time-out are generated when the i 2 c bus is considered busy. 16.7.3 ten-bit addressing ten-bit addressing is accomplished by the i 2 c master sending a second address byte to extend a particular range of standard 7-bit addr esses. in the case of the master writing to the slave, the i 2 c frame simply continues with data after the 2 address bytes. for the master to read from a slave, it needs to reverse the data direction after the second address byte. this is done by sending a repeat ed start, followed by a repeat of the same standard 7-bit address, with a read bit. the slave must remember that it had been addressed by the previous write operation a nd stay selected for the subsequent read with the correct partial i 2 c address. for the master function, the i2c is simply instructed to perfo rm the 2-byte addressing as a normal write operation, followed either by more write data, or by a repeated start with a repeat of the first part of the 10-bit slave address and then reading in the normal fashion. for the slave function, the first part of the address is automatically matched in the same fashion as 7-bit addressing. the slave address qualifier feature (see section 16.6.14 ) can be used to intercept all potential 10-bit addresses (first address byte values f0 through f6), or just one. in the case of slave re ceiver mode, data is received in the normal fashion after software matches the first data byte to the remaining portion of the 10-bit address. the slave function should record the fact that it has been addressed, in case there is a follow-up read operation. for slave transmitter mode, the slave function responds to the initial address in the same fashion as for slave receiver mode, and ch ecks that it has previously been addressed with a full 10-bit address. if the address matche d is address 0, and address qualification is enabled, software must check that the first pa rt of the 10-bit address is a complete match to the previous address before acknowledging the address. 16.7.4 clocking and power considerations the master function of the i 2 c always requires a peripheral clock to be running in order to operate. the slave function can operate withou t any internal clocking when the slave is not currently addressed. this means that reduced power modes up to power-down mode can be entered, and the devi ce will wake up when the i 2 c slave function recognizes an address. monitor mode can similarly wake up the device from a reduced power mode when information becomes available.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 205 of 313 nxp semiconductors um10601 chapter 16: lpc800 i2c-bus interface 16.7.5 lnterrupts the i2c provides a single interrupt output that handles all interrupts for master, slave, and monitor functions.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 206 of 313 17.1 how to read this chapter spi0 is available on all parts. spi1 is available on parts lpc812m101fdh16 and LPC812M101FDH20 only. 17.2 features ? data frames of 1 to 16 bits supported directly. larger frames supported by software. ? master and slave operation. ? data can be transmitted to a slave without the need to read incoming data. this can be useful while setting up an spi memory, for instance. ? control information can optionally be writ ten along with data. this allows very versatile operation, including ?any length? frames. ? one slave select input/output with selectable polarity and flexible usage. remark: texas instruments ssi and national microwire modes are not supported. 17.3 basic configuration configure spi0/1 using the following registers: ? in the sysahbclkctrl regist er, set bit 11 and 12 ( table 18 ) to enable the clock to the register interface. ? clear the spi0/1 peripheral resets using the presetct rl register ( table 7 ). ? enable/disable the spi0/1 interrupts in interrupt slots #0 and 1 in the nvic. ? configure the spi0/1 pin functions through the switch matrix. see section 17.4 . ? the peripheral clock for both spis is the system clock (see figure 3 ? lpc800 clock generation ? ). 17.3.1 configure the spis for wake-up the spi can wake up the system from sleep mode in master or slave mode. um10601 chapter 17: lpc800 spi0/1 rev. 1.0 ? 7 november 2012 preliminary user manual fig 26. spi clocking "#!
'6*6'+) 6*4%" 
)%(+
!"#!    $d$(+<
!"#!    .
1 a,
!"#!
+&%c"+b ,-
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 207 of 313 nxp semiconductors um10601 chapter 17: lpc800 spi0/1 if the spi is configured for slave mode, the spi block can create an interrupt on a received signal even when the spi receives no clocks from the arm cortex-m0+ core, which is the case when the system is in deep-sleep or power-down mode. 17.3.1.1 wake-up from sleep mode ? configure the spi in either master or slave mode. see table 189 . ? enable the spi inte rrupt in the nvic. ? any spi interrupt wakes up the part from sleep mode. enable the spi interrupt in the intenset register ( table 192 ). 17.3.1.2 wake-up from deep-sleep or power-down mode ? configure the spi in slave mode. see table 189 . you must connect the sck function to a pin and connect the pin to the master. ? enable the spi inte rrupt in the starterp1 register. see table 34 ? start logic 1 interrupt wake-up enable register (starterp1, address 0x4004 8214) bit description ? . ? enable the spi inte rrupt in the nvic. ? the spi wakes up the part from deep-sleep or power-down mode on the following events that cause an interrupt: ? a change in the state of the ssel pin. ? . remark: enable the interrupt for each wake-up event in the intenset register ( table 192 ). 17.4 pin description the spi signals are movable functions and are assigned to external pins through the switch matrix. see section 9.3.1 ? connect an internal signal to a package pin ? to assign the spi functions to pins on the lpc800 package.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 208 of 313 nxp semiconductors um10601 chapter 17: lpc800 spi0/1 table 187: spi pin description function direct ion pin description swm register reference spi0_sck i/o any serial clock. sck is a clock signal used to synchronize the transfer of data. it is driven by the master and received by the slave. when the spi interface is used, the clock is programmable to be active-high or active-low. sck only switches during a data transfer. it is driven whenever the master bit in cfg equals 1, regardless of the state of the enable bit. pinassign3 ta b l e 9 9 spi0_mosi i/o any master out slave in. the mosi signal transfers serial data from the master to the slave. when the spi is a master, it outputs serial data on this signal. when the spi is a slave, it clocks in serial data from this signal. mosi is driven whenever the master bit in sp incfg equals 1, regardless of the state of the enable bit. pinassign4 ta b l e 1 0 0 spi0_miso i/o any master in slave out. the miso signal transfers serial data from the slave to the master. when the spi is a master, serial data is input from this signal. when the spi is a slave, serial data is output to this signal. miso is driven when the spi block is enabled, the master bit in cfg equals 0, and when the slave is selected by one or more ssel signals. pinassign4 ta b l e 1 0 0 spi0_ssel i/o any slave select . when the spi interface is a master, it will drive the ssel signals to an active st ate before the st art of serial data and then release them to an inactive state after the serial data has been sent. by default, this signal is active low but can be selected to operate as active high. when the spi is a slave, any ssel in an active stat e indicates that this slave is being addressed. the ssel pin is driven whenever the master bit in the cfg register equals 1, regardless of the state of the enable bit. pinassign4 ta b l e 1 0 0 spi1_sck i/o any serial clock. pinassign4 ta b l e 1 0 0 spi1_mosi i/o any master out slave in. pinassign5 ta b l e 1 0 1 spi1_miso i/o any master in slave out. pinassign5 ta b l e 1 0 1 spi1_ssel i/o any slave select. pinassign5 ta b l e 1 0 1
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 209 of 313 nxp semiconductors um10601 chapter 17: lpc800 spi0/1 17.5 general description 17.6 register description the reset value reflects the data stored in used bits only. it does not include reserved bits content. (1) includes cpol, cpha, lsbf, flen, master, enable, transfe r_delay, frame_delay, pre_delay, post_delay, sot, eot, eof, rxignore, individual interrupt enables. fig 27. spi block diagram     %'
6&(+)9%!+ 2
769(
+=6 $(+) o
(%(+
%!76&+ 2
769(
+=6 $(+) o
(%(+
%!76&+ &- 3 &-3 +&+)%"
!#&()#"$
o
9#)<%(
!#&96=;)%(6#&$
ab 
96+"'  2

 
56&
"+*+"$ 2'd
2* "#!
'6*6'+) 6&(+)&%"
!"#! a$b 6*4%" &(+));5(
!#&()#" 2
6&(+));5($ 2
6&(+));5($ 
6&(+));5( - table 188. register overview: spi (base address 0x4005 8000 (spi0) and 0x4008 c000 (spi1)) name access offset description reset value reference cfg r/w 0x000 spi configuration register 0 table 189 dly r/w 0x004 spi delay register 0 table 190 stat r/w 0x008 spi status. some status flags can be cleared by writing a 1 to that bit position 0x0102 table 191
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 210 of 313 nxp semiconductors um10601 chapter 17: lpc800 spi0/1 intenset r/w 0x00c spi interrupt enable read and set. a complete value may be read from this register. writing a 1 to any implemented bit position causes that bit to be set. 0 table 192 intenclr w 0x010 spi interrupt enable clear. writing a 1 to any implemented bit position causes the corresponding bit in intenset to be cleared. na table 193 rxdat r 0x014 spi receive data na table 194 txdatctl r/w 0x018 spi transmit data with control 0 table 195 txdat r/w 0x01c spi transmit data 0 table 196 txctl r/w 0x020 spi transmit control 0 table 197 div r/w 0x024 spi clock divider 0 table 198 intstat r 0x028 spi interrupt status 0x02 table 199 table 188. register overview: spi (base addre ss 0x4005 8000 (spi0) and 0x4008 c000 (spi1)) ?continued name access offset description reset value reference
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 211 of 313 nxp semiconductors um10601 chapter 17: lpc800 spi0/1 17.6.1 spi configuration register the cfg register contains information for t he general configuration of the spi. typically, this information is not changed during operat ion. some configurat ions, such as cpol, cpha, and lsbf should not be made while the spi is not fully idle. see the description of the idle status (in table 191 ) for more information. remark: if the interface is re-configured from ma ster mode to slave mode or the reverse (an unusual case), the spi should be disabled and re-enabled with the new configuration. table 189. spi configuration register (cfg, addr esses 0x4005 8000 (spi0) , 0x4005 c000 (spi1)) bit description bit symbol value description reset value 0 enable spi enable. 0 0 disabled. the spi is disabled and the internal state machine and counters are reset. 1 enabled. the spi is enabled for operation. 1 - reserved. read value is undefined, only zero should be written. na 2 master master mode select. 0 0 slave mode. the spi will operate in slave mode. sck, mosi, and the ssel signals are inputs, miso is an output. 1 master mode. the spi will operate in mast er mode. sck, mosi, and the ssel signals are outputs, miso is an input. 3 lsbf lsb first mode enable. 0 0 standard. data is transmitted and received in standard msb first order. 1 reverse. data is transmitted and received in reverse order (lsb first). 4 cpha clock phase select. 0 0 change. the spi captures serial data on the fi rst clock transition of the frame (when the clock changes away from the rest state). data is changed on the following edge. 1 capture. the spi changes serial data on the fi rst clock transition of the frame (when the clock changes away from the rest state). data is captured on the following edge. 5 cpol clock polarity select. 0 0 low. the rest state of the cl ock (between frames) is low. 1 high. the rest state of the clock (between frames) is high. 6 - reserved. read value is undefined, only zero should be written. na 7 loop loopback mode enable. loopback mode appl ies only to master mode, and connects transmit and receive data connected toget her to allow simple software testing. 0 0 disabled. 1 enabled. 8 spol ssel polarity select. 0 0 low. the ssel pin is active low. the value in the ssel fields of the rxdat, txdatctl, and txctl registers relate d to ssel is not inverted relative to the pins. 1 high. the ssel pin is acti ve high. the value in the ssel fields of the rxdat, txdatctl, and txctl registers related to ssel is inverted relative to the pins. 31:9 - reserved. read value is undefined, only zero should be written. na
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 212 of 313 nxp semiconductors um10601 chapter 17: lpc800 spi0/1 17.6.2 spi delay register the dly register controls several programma ble delays related to spi signalling. these delays apply only to master mode, and are all stated in spi clocks. timing details are shown in: section 17.7.2.1 ? pre_delay and post_delay ? section 17.7.2.2 ? frame_delay ? section 17.7.2.3 ? transfer_delay ? table 190. spi delay register (dly, addresses 0x4005 8004 (spi0) , 0x4005 c004 (spi1)) bit description bit symbol description reset value 3:0 pre_delay controls the amount of time between ssel assertion and the beginning of a data frame. there is always one spi clock time between ssel assertion and the first clock edge. this is not considered part of the pre-delay. 0x0 = no additional time is inserted. 0x1 = 1 spi clock time is inserted. 0x2 = 2 spi clock times are inserted. ... 0xf = 15 spi clock times are inserted. 0 7:4 post_delay controls the amount of time between the end of a data frame and ssel deassertion. 0x0 = no additional time is inserted. 0x1 = 1 spi clock time is inserted. 0x2 = 2 spi clock times are inserted. ... 0xf = 15 spi clock times are inserted. 0 11:8 frame_delay controls the minimum amount of time between adjacent data frames. 0x0 = no additional time is inserted. 0x1 = 1 spi clock time is inserted. 0x2 = 2 spi clock times are inserted. ... 0xf = 15 spi clock times are inserted. 0 15:12 transfer_delay controls the minimum amount of ti me that the ssel is dea sserted between transfers. 0x0 = the minimum time that ssel is deasserted is 1 spi clock time. (zero added time.) 0x1 = the minimum time that ssel is deasserted is 2 spi clock times. 0x2 = the minimum time that ssel is deasserted is 3 spi clock times. ... 0xf = the minimum time that ssel is deasserted is 16 spi clock times. 0 31:16 - reserved. read value is undefined, only zero should be written. na
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 213 of 313 nxp semiconductors um10601 chapter 17: lpc800 spi0/1 17.6.3 spi status register the stat register provides spi status flags for software to read, and a control bit for forcing an end of transfer. flags other than r ead-only flags may be cleared by writing ones to corresponding bits of stat. stat contains 2 error flags. rxov and txur. these are receiver overrun and transmit underrun, respectively. if either of these errors occur during operation, the spi should be disabled, then re-enabled in order to make sure all internal states are cleared before attempting to resume operation. in this register, the following notation is used: ro = read-only, w1 = write 1 to clear.. table 191. spi status register (stat, addresses 0 x4005 8008 (spi0) , 0x4005 c0 08 (spi1)) bit description bit symbol description reset value access [1] 0 rxrdy receiver ready flag. when 1, indicates that data is available to be read from the receiver buffer. cleared after a read of the rxdat register. 0ro 1 txrdy transmitter ready flag. when 1, this bit indicates that data may be written to the transmit buffer. previous data may still be in the process of being transmitted. cleared when data is written to txdat or txdatctl until the data is moved to the transmit shift register. 1ro 2 rxov receiver overrun interrupt flag. this flag is set when the beginning of a received character is detected while the re ceiver buffer is still in use. if this occurs, the receiver buffer contents are preserved, and the incoming data is lost. data received by the spi should be considered undefined if rxov is set. 0w1 3 txur transmitter underrun interrupt flag. this flag applies only to slave mode (master = 0). in this case, the transmitter must begin sending new data on the next input clock if the transmitter is id le. if that data is not available in the transmitter holding register at that poin t, there is no data to transmit and the txur flag is set. data transmitted by the spi should be considered undefined if txur is set. 0w1 4 ssa slave select assert. this flag is set whenever any slave select transitions from deasserted to asserted, in both mast er and slave modes. this allows determining when the spi transmit/receive functions become busy, and allows waking up the device from reduced power modes when a slave mode access begins. this flag is cleared by software. 0w1 5 ssd slave select deassert. this flag is set whenever any asserted slave selects transition to deasserted, in both master and slave modes. this allows determining when the spi transmit/receive functions become idle. this flag is cleared by software. 0w1 6 stalled stalled status flag. this indicates whether the spi is currently in a stall condition. 0ro 7 endtransfer end transfer control bit. software can set this bit to force an end to the current transfer when the transmitter finishes any activity already in progress, as if the eot flag had been set prior to the last transmission. this capability is included to support cases where it is not known w hen transmit data is written that it will be the end of a transfer. the bit is cleared when the transmitter becomes idle as the transfer comes to an end. forcing an end of transfer in this manner causes any specified framedelay and transferdelay to be inserted. 0 ro/w1 8 idle idle status flag. this bit is 1 whenever the spi master function is fully idle. this means that the transmit holding register is empty and the transmitter is not in the process of sending data. 1ro 31:9 - reserved. read value is undefined, only zero should be written. na na
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 214 of 313 nxp semiconductors um10601 chapter 17: lpc800 spi0/1 [1] ro = read-only, w1 = write 1 to clear. 17.6.4 spi interrupt enable read and set register the intenset register is used to enable various spi interrupt sources. enable bits in intenset are mapped in locations that correspond to the flags in the stat register. the complete set of interrupt enables may be read from this register. writing ones to implemented bits in this register causes thos e bits to be set. the intenclr register is used to clear bits in this register. see table 191 for details of the interrupts. table 192. spi interrupt enable read and set register (intenset, addresses 0x4005 800c (spi0) , 0x4005 c00c (spi1)) bit description bit symbol value description reset value 0 rxrdyen determines whether an interrupt occurs when receiver data is available. 0 0 no interrupt will be generated when receiver data is available. 1 an interrupt will be generated when receiver data is available in the rxdat register. 1 txrdyen determines whether an interrupt occurs when the transmitter holding register is available. 0 0 no interrupt will be generated when the transmitter holding register is available. 1 an interrupt will be generated when data may be written to txdat. 2 rxoven determines whether an interrupt occurs wh en a receiver overrun occurs. this happens in slave mode when there is a need for the receiver to move newly received data to the rxdat register when it is already in use. the interface prevents receiver overrun in master mode by not allowing a new transmission to begin when a receiver overrun would otherwise occur. 0 0 no interrupt will be generated when a receiver overrun occurs. 1 an interrupt will be generated if a receiver overrun occurs. 3 txuren determines whether an interrupt occurs when a transmitter underrun occurs. this happens in slave mode when there is a need to transmit data when none is available. 0 0 no interrupt will be generated when the transmitter underruns. 1 an interrupt will be generated if the transmitter underruns. 4 ssaen determines whether an interrupt occurs when the slave select is asserted. 0 0 no interrupt will be generated when any slave select transitions from deasserted to asserted. 1 an interrupt will be generated when any slav e select transitions from deasserted to asserted. 5 ssden determines whether an interrupt occurs when the slave select is deasserted. 0 0 no interrupt will be generated when all assert ed slave selects transition to deasserted. 1 an interrupt will be generated when all asserted slave selects transition to deasserted. 31:6 - reserved. read value is undefined, only zero should be written. na
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 215 of 313 nxp semiconductors um10601 chapter 17: lpc800 spi0/1 17.6.5 spi interrupt enable clear register the intenclr register is used to clear interrupt enable bits in the intenset register. 17.6.6 spi receiver data register the read-only rxdat register provides the means to read the most recently received data. the value of ssel can be read along with the data. for details on the slave select process, see section 17.7.4 . table 193. spi interrupt enable clear register (intenclr, addresses 0x4005 8010 (spi0) , 0x4005 c010 (spi1)) bit description bit symbol description reset value 0 rxrdyen writing 1 clears the corresponding bits in the intenset register. 0 1 txrdyen writing 1 clears the corresponding bits in the intenset register. 0 2 rxoven writing 1 clears the corresponding bits in the intenset register. 0 3 txuren writing 1 clears the corresponding bits in the intenset register. 0 4 ssaen writing 1 clears the corresponding bits in the intenset register. 0 5 ssden writing 1 clears the corresponding bits in the intenset register. 0 31:6 - reserved. read value is undefined, only zero should be written. na table 194. spi receiver data register (rxd at, addresses 0x4005 8014 (spi0) , 0x4005 c014 (spi1)) bit description bit symbol description reset value 15:0 rxdat receiver data. this contains the next piece of received data. the number of bits that are used depends on the flen setting in txctl / txdatctl. undefined 16 rxsseln slave select for receive. this field allows the state of the ssel pin to be saved along with received data. the value will reflect the ssel pin for both master and slave opera tion. a zero indicates that a slave select is active. the actual polarity of each slave select pin is configured by the related spol bit in cfg. undefined 19:17 - reserved. - 20 sot start of transfer flag. this flag will be 1 if this is the first frame after ssel went from deasser ted to asserted (i.e., any previous transfer has ended). this information can be used to identify the first piece of data in cases where the frame length is greater than 16 bit. 31:21 - reserved, the value read from a reserved bit is not defined. na
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 216 of 313 nxp semiconductors um10601 chapter 17: lpc800 spi0/1 17.6.7 spi transmitter da ta and control register the txdatctl register provides a location where both transmit data and control information can be written simultaneously. this allows detailed control of the spi without a separate write of control info rmation for each piece of data. when control information remains static during transmit, the txdat register should be used (see section 17.6.8 ) instead of the txdatctl register. control information can then be written separately via the txctl register (see section 17.6.9 ). the upper part of txdatctl (bits 27 to 16) are the same bits contained in the txctl register. the two registers simply provide tw o ways to access them. for details on the slave select process, see section 17.7.4 . for details on using multiple consecutive frames for frame lengths larger than 16 bit, see section 17.7.5 ? data lengths greater than 16 bits ? . table 195. spi transmitter data and control register (txdatctl, addresses 0x4005 8018 (spi0) , 0x4005 c018 (spi1)) bit description bit symbol value description reset value 15:0 txdat transmit data. this field provides fr om 1 to 16 bits of data to be transmitted. 0 16 txsseln transmit slave select . th is field controls what is ou tput for ssel in master mode. remark: the active state of the ssel function is configured by bits in the cfg register. 0 0 ssel asserted. 1 ssel not asserted. 19:17 - reserved. 20 eot end of transfer. the asserted ssel will be deasserted at the end of a transfer, and remain so for at least the time specified by the transfer_delay value in the dly register. 0 0 ssel not deasserted. this piece of data is not treated as the end of a transfer. ssel will not be deasserted at the end of this data. 1 ssel deasserted. this piece of data is treated as the end of a transfer. ssel will be deasserted at the end of this piece of data. 21 eof end of frame. between frames, a delay may be inserted, as defined by the frame_delay value in the dly register. t he end of a frame may not be particularly meaningful if the frame_delay value = 0. this control can be used as part of the support for frame lengths greater than 16 bits. 0 0 data not eof. this piece of data transmit ted is not treated as the end of a frame. 1 data eof. this piece of data is treate d as the end of a frame, causing the frame_delay time to be inserted before subsequent data is transmitted. 22 rxignore receive ignore. this allows data to be transmitted using the spi without the need to read unneeded data from the receiver to simplify the transmit process. 0 0 read received data. received data must be read in order to allow transmission to progress. in slave mode, an overrun error will occur if received data is not read before new data is received. 1 ignore received data. received data is ig nored, allowing transmission without reading unneeded received data. no receiver flags are generated.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 217 of 313 nxp semiconductors um10601 chapter 17: lpc800 spi0/1 17.6.8 spi transmitter data register the txdat register is written in order to send data via the spi transmitter when control information is not changing during the transfer (see section 17.6.7 ). that data will be sent to the transmit shift register when it is available, and another character may then be written to txdat. 17.6.9 spi transmitter control register the txctl register provides a way to separa tely access control information for the spi. these bits are another view of the same-n amed bits in the txdatctl register (see section 17.6.7 ). changing bits in txctl has no effe ct unless data is later written to the txdat register. data written to txdatctl overwrites the txctl register. when control information needs to be changed during transmission, the txdatctl register should be used (see section 17.6.7 ) instead of txdat. control information can then be written along with data. 23 - reserved. read value is undefined, only zero should be written. na 27:24 flen frame length. specifies the frame length from 1 to 16 bits. note that frame lengths greater than 16 bits are supported by implementing multiple sequential frames. note that if a 1-bit frame is selected, the master function will always insert a delay with a length of one sck time following the single clock seen on the sck pin. 0x0 = data frame is 1 bit in length. 0x1 = data frame is 2 bits in length. 0x2 = data frame is 3 bits in length. ... 0xf = data frame is 16 bits in length. 0x0 31:28 - reserved. read value is undefined, only zero should be written. na table 195. spi transmitter data and control register (txdatctl, addresses 0x4005 8018 (spi0) , 0x4005 c018 (spi1)) bit description ?continued bit symbol value description reset value table 196. spi transmitter data register (txdat, addresses 0x4005 801st (spi0) , 0x4005 c00c (spi1)) bit description bit symbol description reset value 15:0 data transmit data. this field provides from 4 to 16 bits of data to be transmitted. 0 31:16 - reserved. only zero should be written. na
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 218 of 313 nxp semiconductors um10601 chapter 17: lpc800 spi0/1 17.6.10 spi divider register the div register determines the clock used by the spi in master mode. for details on clocking, see section 17.7.3 ? clocking and data rates ? . 17.6.11 spi interrupt status register the read-only intstat register provides a view of those interrupt flags that are currently enabled. this can simplify software handling of interrupts. see ta b l e 1 9 1 for detailed descriptions of the interrupt flags. table 197. spi transmitter control register (txctl, addresses 0x4005 8020 (spi0) , 0x4005 c020 (spi1)) bit description bit symbol description reset value 15:0 - reserved. read value is undefin ed, only zero should be written. na 16 tx ssel transmit slave select. 0x0 19:17 - reserved. 0x0 20 eot end of transfer. 0 21 eof end of frame. 0 22 rxignore receive ignore. 0 23 - reserved. read value is undefined, only zero should be written. na 27:24 flen frame length. 0x0 31:28 - reserved. read value is undefined, only zero should be written. na table 198. spi divider register (div, addre sses 0x4005 8024 (spi0) , 0x4005 c024(spi1)) bit description bit symbol description reset value 15:0 divval rate divider value,1. specifie s how the pclk for the spi is divided to produce the spi clock rate in master mode. divval is -1 encoded such that th e value 0 results in pclk/1, the value 1 results in pclk/2, up to the maximum possible divide value of 0xffff, which results in pclk/65536. 0 31:16 - reserved. read value is undefined, only zero should be written. na table 199. spi interrupt status register (intstat, addresses 0x4005 8028 (spi0) , 0x4005 c028 (spi1)) bit description bit symbol description reset value 0 rxrdy receiver ready flag. 0 1 txrdy transmitter ready flag. 1 2 rxov receiver overrun interrupt flag. 0 3 txur transmitter underrun interrupt flag. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 219 of 313 nxp semiconductors um10601 chapter 17: lpc800 spi0/1 4 ssa slave select assert. 0 5 ssd slave select deassert. 0 31:6 - reserved. read value is undefined, only zero should be written. na table 199. spi interrupt status register (intstat, addresses 0x4005 8028 (spi0) , 0x4005 c028 (spi1)) bit description bit symbol description reset value
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 220 of 313 nxp semiconductors um10601 chapter 17: lpc800 spi0/1 17.7 functional description 17.7.1 operating modes: clock and phase selection spi interfaces typically allo w configuration of clock phase and polarity. these are sometimes referred to as numbered spi modes, as described in table 200 and shown in figure 28 . cpol and cpha are configured by bits in the cfg register ( section 17.6.1 ). table 200: spi mode summary cpol cpha spi mode description sck rest state sck data change edge sck data sample edge 000 the spi captures serial data on the first clock transition of the frame (when the clock changes away from the rest state). data is changed on the following edge. low falling rising 011 the spi changes serial data on the first clock transition of the frame (when the clock changes away from the rest state). data is captured on the following edge. low rising falling 1 0 2 same as mode 0 with sck inverted. high rising falling 1 1 3 same as mode 1 with sck inverted. high falling rising fig 28. basic spi operating modes 
i
     
i
,           #'+
,
a
i
,b
 #'+

a
i
b
 #'+

a
i
,b
 #'+
/
a
i
b
 %(%
9)%<+ %(%
9)%<+
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 221 of 313 nxp semiconductors um10601 chapter 17: lpc800 spi0/1 17.7.2 frame delays several delays can be specified for spi frames. these include: ? pre_delay: delay after ssel is asserted before data clocking begins ? post_delay: delay at the end of a data frame before ssel is deasserted ? frame_delay: delay betw een data frames when ssel is not deasserted ? transfer_delay: minimum duration of ssel in the deasserted state between transfers 17.7.2.1 pre_delay and post_delay pre_delay and post_delay are illu strated by the examples in figure 29 . the pre_delay value controls the amount of time between ss el being asserted and the beginning of the subsequent data frame. the post_delay value controls the amount of time between the end of a data frame and the deassertion of ssel. fig 29. pre_delay and post_delay )+ %&'
5#$( '+"%d 0

i
,
)+-'+"%d
i

#$(-'+"%d
i
 #'+

a
i
b
        )+-'+"%d #$(-'+"%d #'+
,
a
i
,b
 )+ %&'
5#$( '+"%d 0

i

)+-'+"%d
i

#$(-'+"%d
i
 #'+
/
a
i
b
  )+-'+"%d #$(-'+"%d #'+

a
i
,b
 %(%
9)%<+ %(%
9)%<+    
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 222 of 313 nxp semiconductors um10601 chapter 17: lpc800 spi0/1 17.7.2.2 frame_delay the frame_delay value controls the amount of time at the end of each frame. this delay is inserted when the eof bi t = 1. frame_delay is illust rated by the examples in figure 30 . note that frame boundaries occur only where specified. this is because frame lengths can be any size, involving multiple data writes. see section 17.7.5 for more information. fig 30. frame_delay )%<+
'+"%d 0

i
,
)%<+ -'+"%d
i

)+-'+"%d
i
,
#$(-'+"%d
i
, #'+

a
i
b
 )%<+-'+"%d #'+
,
a
i
,b
          +!#&'
'%(%
9)%<+   )%<+
'+"%d 0

i

)%<+ -'+"%d
i

)+-'+"%d
i
,
#$(-'+"%d
i
,        #'+

a
i
,b
 #'+
/
a
i
b
 )%<+-'+"%d   +!#&'
'%(%
9)%<+ 6)$(
'%(%
9)%<+ 6)$(
'%(%
9)%<+  
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 223 of 313 nxp semiconductors um10601 chapter 17: lpc800 spi0/1 17.7.2.3 transfer_delay the transfer_delay value controls the minimum amount of time that ssel is deasserted between transfers, because th e eot bit = 1. when transf er_delay = 0, ssel may be deasserted for a minimum of one spi clock time. transfer_d elay is illustrated by the examples in figure 31 . fig 31. transfer_delay )%<+
'+"%d 0

i
,
)%<+ -'+"%d
i

)+-'+"%d
i
,
#$(-'+"%d
i
, #'+

a
i
b
 )%<+-'+"%d #'+
,
a
i
,b
          +!#&'
'%(%
9)%<+   )%<+
'+"%d 0

i

)%<+ -'+"%d
i

)+-'+"%d
i
,
#$(-'+"%d
i
,        #'+

a
i
,b
 #'+
/
a
i
b
 )%<+-'+"%d   +!#&'
'%(%
9)%<+ 6)$(
'%(%
9)%<+ 6)$(
'%(%
9)%<+  
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 224 of 313 nxp semiconductors um10601 chapter 17: lpc800 spi0/1 17.7.3 clocking and data rates in order to use the spi, clocking details must be defined. this includes configuring the system clock and selection of the clock divider value in div. see figure 26 . 17.7.3.1 data rate calculations the spi interface is designed to operate asynchronously from any on-chip clocks, and without the need for overclocking. in slave mode, this means that the sck from th e external master is used directly to run the transmit and receive shift registers and ot her logic. the upper rate limit depends on the speed of the logic and pin electronics, and signalling quality in the external connections. in master mode, the spi rate clock produced by the spi clock divider is used directly as the outgoing sck. again, the upper rate limit depends on the speed of the logic and pin electronics, and signalling qualit y in the external connections. the spi clock divider is an integer divider. the spi in master mode can be set to run at the same speed as the selected pclk, or at lower integer di vide rates. the spi rate will be = pclk_spin / divval. in slave mode, the clock is taken from the sc k input and the spi clock divider is not used. 17.7.4 slave select the spi block provides for one slave select input in slave mode or output in master mode. the ssel can be set for normal polarity (active low) , or can be inve rted (active high). representation of the ssel in a register is always active low. if the ssel is inverted, this is done as the si gnal leaves/enters the spi block. in slave mode, the asserted ssel that is connected to a pin will activate the spi. in master mode, the ssel that is connected to a pin will be ou tput as defined in the spi registers. in master mode, the slave select is configured by the txsse ln field, which appears in both the ccd and detect register s. in slave mode, the state of the ssel is saved along with received data in the rxsseln field of the rxdat register. 17.7.5 data lengths greater than 16 bits the spi interface handles data frame sizes from 1 to 16 bits directly. larger sizes can be handled by splitting data up into groups of 16 bits or less. for example, 24 bits can be supported as 2 groups of 16 bits and 8 bits or 2 groups of 12 bits, among others. frames of any size, including greater than 32 bits, can supported in the same way. details of how to handle larger data width s depend somewhat on other spi configuration options. for instance, if it is intended for slave selects to be deasserted between frames, then this must be suppressed when a larger frame is split into more than one part. sending 2 groups of 12 bits with ssel de asserted between 24-b it increments, for instance, would require changing the value of the eof bit on alternate 12-bit frames.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 225 of 313 nxp semiconductors um10601 chapter 17: lpc800 spi0/1 17.7.6 data stalls a stall for master transmit data can happen in modes 0 and 2 when sck cannot be returned to the rest state until the msb of the next data frame can be driven on mosi. in this case, the stall happens just before the final clock edge of data if the next piece of data is not yet available. a stall for master receive can happen when a receiver overrun would otherwise occur if the transmitter was not stalled. in modes 0 and 2, this occurs if th e previously received data is not read before the end of the next piece of is received. this stall happens one clock edge earlier than the transmitter stall. in modes 1 and 3, the same kind of receiver stall can occur, but just before the final clock edge of the received data. also, a trans mitter stall will not happen in modes 1 and 3 because the transmitted data is complete at the point where a stall would otherwise occur, so it is not needed. stalls are reflected in the stat register by the stalled status flag, which indicates the current spi status.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 226 of 313 nxp semiconductors um10601 chapter 17: lpc800 spi0/1 fig 32. examples of data stalls )%&$<6((+)
$(%""0

i
,
)%<+ -'+"%d
i
,
)+-'+"%d
i
,
#$(-'+"%d
i
,

!"#!
$(%"" #'+

a
i
b
 #'+
,
a
i
,b
   +!#&'
'%(%
9)%<+ +!+6*+)
$(%""0

i

)%<+ -'+"%d
i
,
)+-'+"%d
i
,
#$(-'+"%d
i
,

!"#!
$(%""   #'+

a
i
,b
 #'+
/
a
i
b
 +!#&'
'%(%
9)%<+ 6)$(
'%(%
9)%<+ 6)$(
'%(%
9)%<+ +!+6*+)
$(%""0

i
,
)%<+ -'+"%d
i
,
)+-'+"%d
i
,
#$(-'+"%d
i
,

!"#!
$(%"" #'+

a
i
b
 #'+
,
a
i
,b
   +!#&'
'%(%
9)%<+ 6)$(
'%(%
9)%<+                        
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 227 of 313 18.1 how to read this chapter the crc engine is available on all lpc800 parts. 18.2 features ? supports three common polynomials crc-ccitt, crc-16, and crc-32. ? crc-ccitt: x 16 + x 12 + x 5 + 1 ? crc-16: x 16 + x 15 + x 2 + 1 ? crc-32: x 32 + x 26 + x 23 + x 22 + x 16 + x 12 + x 11 + x 10 + x 8 + x 7 + x 5 + x 4 + x 2 + x + 1 ? bit order reverse and 1?s complement programmable setting for input data and crc sum. ? programmable seed number setting. ? supports cpu pio back-to-back transfer. ? accept any size of data width per write: 8, 16 or 32-bit. ? 8-bit write: 1-cycle operation ? 16-bit write: 2-cycle op eration (8-bit x 2-cycle) ? 32-bit write: 4-cycle op eration (8-bit x 4-cycle) 18.3 basic configuration enable the clock to th e crc engine in the sysahbclkctrl register ( table 18 , bit 13). 18.4 pin description the crc engine has no configurable pins. 18.5 general description the cyclic redundancy check (crc) genera tor with programmable polynomial settings supports several crc standards commonly used. um10601 chapter 18: lpc800 cyclic re dundancy check (crc) engine rev. 1.0 ? 7 november 2012 preliminary user manual
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 228 of 313 nxp semiconductors um10601 chapter 18: lpc800 cyclic redundancy check (crc) engine 18.6 description 18.7 register description fig 33. crc block diagram       /      4 q$  /   ,   l    q$   4        3  3  3 
 
  

 
 table 201. register overview: crc en gine (base address 0x5000 0000) name access address offset description reset value mode r/w 0x00 crc mode register 0x0000 0000 seed r/w 0x04 crc seed register 0x0000 ffff sum ro 0x08 crc checksum register 0x0000 ffff wr_data wo 0x08 crc data register -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 229 of 313 nxp semiconductors um10601 chapter 18: lpc800 cyclic redundancy check (crc) engine 18.7.1 crc mode register 18.7.2 crc seed register 18.7.3 crc checksum register this register is a read-only register cont aining the most recent checksum. the read request to this register is auto matically delayed by a finite number of wait states until the results are valid and the checksum computation is complete. 18.7.4 crc data register this register is a write-only register containing the data block for which the crc sum will be calculated. table 202. crc mode register (mode, ad dress 0x5000 0000) bit description bit symbol description reset value 1:0 crc_poly crc polynom: 1x= crc-32 polynomial 01= crc-16 polynomial 00= crc-ccitt polynomial 00 2 bit_rvs_wr data bit order: 1= bit order reverse for crc_wr_data (per byte) 0= no bit order reverse for crc_wr_data (per byte) 0 3 cmpl_wr data complement: 1= 1?s complement for crc_wr_data 0= no 1?s complement for crc_wr_data 0 4 bit_rvs_sum crc sum bit order: 1= bit order reverse for crc_sum 0= no bit order reverse for crc_sum 0 5 cmpl_sum crc sum complement: 1= 1?s complement for crc_sum 0=no 1?s complement for crc_sum 0 31:6 reserved always 0 when read 0x0000000 table 203. crc seed register (seed, address 0x5000 0004) bit description bit symbol description reset value 31:0 crc_seed a write access to this register will load crc seed value to crc_sum register with selected bit order and 1?s complement pre-processes. remark: a write access to this register will overrule the crc calculation in progresses. 0x0000 ffff table 204. crc checksum register (sum, address 0x5000 0008) bit description bit symbol description reset value 31:0 crc_sum the most recent crc sum can be read through this register with selected bit order and 1?s complement post-processes. 0x0000 ffff
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 230 of 313 nxp semiconductors um10601 chapter 18: lpc800 cyclic redundancy check (crc) engine table 205. crc data register (wr_data, address 0x5000 0008) bit description bit symbol description reset value 31:0 crc_wr_data data written to this register will be taken to perform crc calculation with selected bit order and 1?s complement pre-process. any write size 8, 16 or 32-bit are allowed and accept back-to-bac k transactions. -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 231 of 313 nxp semiconductors um10601 chapter 18: lpc800 cyclic redundancy check (crc) engine 18.8 functional description the following sections describe the register settings for each supported crc standard: 18.8.1 crc-ccitt set-up polynomial = x 16 + x 12 + x 5 + 1 seed value = 0xffff bit order reverse for data input: no 1's complement for data input: no bit order reverse for crc sum: no 1's complement for crc sum: no crc_mode = 0x0000 0000 crc_seed = 0x0000 ffff 18.8.2 crc-16 set-up polynomial = x 16 + x 15 + x 2 + 1 seed value = 0x0000 bit order reverse for data input: yes 1's complement for data input: no bit order reverse for crc sum: yes 1's complement for crc sum: no crc_mode = 0x0000 0015 crc_seed = 0x0000 0000 18.8.3 crc-32 set-up polynomial = x 32 + x 26 + x 23 + x 22 + x 16 + x 12 + x 11 + x 10 + x 8 + x 7 + x 5 + x 4 + x 2 + x + 1 seed value = 0xffff ffff bit order reverse for data input: yes 1's complement for data input: no bit order reverse for crc sum: yes 1's complement for crc sum: yes crc_mode = 0x0000 0036 crc_seed = 0xffff ffff
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 232 of 313 19.1 how to read this chapter the flash controller is identical on all lpc800 parts. 19.2 features ? controls flash access time. ? provides registers for fl ash signature generation. 19.3 general description the flash controller is accessible for programmi ng flash wait states and for generating the the flash signature. 19.4 register description 19.4.1 flash configuration register depending on the system clock frequency, access to the flash memory can be configured with various access times by writing to the flashcfg register at address 0x4003 c010. remark: improper setting of this register may result in incorrect operation of the flash memory. um10601 chapter 19: lpc800 flash controller rev. 1.0 ? 7 november 2012 preliminary user manual table 206. register overview: fmc (base address 0x4004 0000) name access address offset description reset value reference flashcfg r/w 0x010 flash configuration register ta b l e 2 0 7 fmsstart r/w 0x020 signature start address register 0 table 208 fmsstop r/w 0x024 signature stop-address register 0 table 209 fmsw0 r 0x02c signature word - table 210
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 233 of 313 nxp semiconductors um10601 chapter 19: lpc800 flash controller 19.4.2 flash signature start address register 19.4.3 flash signatur e stop address register 19.4.4 flash signature generation result register the signature generation result register re turns the flash signature produced by the embedded signature generator. the generated flash signature can be used to verify the flash memory contents. the generated signature can be compared with an expected signature and thus makes saves time and code space. the method for generating the signature is described in section 19.5.1 . table 207. flash configuration register (fla shcfg, address 0x4003 c010) bit description bit symbol value description reset value 1:0 flashtim flash memory access time . flashtim +1 is equal to the number of system clocks used for flash access. 10 0x0 1 system clock flash acce ss time (for system clock frequencies of up to 20 mhz). 0x1 2 system clocks flash access time (for system clock frequencies of up to 30 mhz). 0x2 reserved. 0x3 reserved. 31:2 - - reserved. user software must not change the value of these bits. bits 31:2 must be written back exactly as read . - table 208. flash module signature start regist er (fmsstart - 0x4003 c020) bit description bit symbol description reset value 16:0 start signature generation start address (corresponds to ahb byte address bits[20:4]). 0 31:17 - reserved, user software should not write ones to reserved bits. the value read from a reserved bit is not defined. na table 209. flash module signature stop regist er (fmsstop - 0x4003 c024) bit description bit symbol value description reset value 16:0 stopa stop address for signature generation (the word specified by stopa is included in the address range). the address is in units of memory words, not bytes. 0 30:17 - reserved, user software should not write ones to reserved bits. the value read from a reserved bit is not defined. 0 31 strtbist when this bit is written to 1, signature generation starts. at the end of signature generation, this bit is automatically cleared. 0
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 234 of 313 nxp semiconductors um10601 chapter 19: lpc800 flash controller 19.5 functional description 19.5.1 flash signature generation the flash module contains a built-in signatu re generator. this generator can produce a 32-bit signature from a range of flash memory . a typical usage is to verify the flashed contents against a calculated signature (e.g. during programming). the address range for generating a signature must be aligned on flash-word boundaries, i.e. 32-bit boundaries. once started, signat ure generation completes independently. while signature generation is in progress, the fl ash memory cannot be accessed for other purposes, and an attempted re ad will cause a wait state to be asserted until signature generation is complete. code outside of the flash (e.g. internal ram) can be executed during signature generation. this can include interrupt services, if the interrupt vector table is re-mapped to memory other than the flash memory. the code that initiates signature generation should also be placed outside of the flash memory. 19.5.1.1 signature generation address and control registers these registers control automatic signature ge neration. a signature can be generated for any part of the flash memory contents. the address range to be used for generation is defined by writing the start address to the signature start address register (fmsstart) and the stop address to the si gnature stop address register (fmsstop. the start and stop addresses must be aligned to 32-bit boundaries. signature generation is started by setting the strtbist bit in the fmsstop register. setting the strtbist bit is typically combined with the signature stop address in a single write. table 208 and table 209 show the bit assignments in the fmsstart and fmsstop registers respectively. 19.5.1.2 signature generation a signature can be generated for any part of the flash contents. the address range to be used for signature generation is defined by writing the start address to the fmsstart register, and the stop address to the fmsstop register. the signature generation is started by writing a 1 to the sig_start bit in the fmsstop register. starting the signature generation is typically combined with defining the stop address, which is done in the stop bits of the same register. the time that the signature generation takes is proportional to the address range for which the signature is generated. reading of the flash memory for signature generation uses a self-timed read mechanism and does not de pend on any configurable timing settings for the flash. a safe estimation for the duration of the sign ature generation is: duration = int((60 / tcy) + 3) x (fmsstop - fmsstart + 1) table 210. fmsw0 register bit descri ption (fmsw0, address: 0x4003 c02c) bit symbol description reset value 31:0 sig 32-bit signature. -
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 235 of 313 nxp semiconductors um10601 chapter 19: lpc800 flash controller when signature generation is triggered via software, the duration is in ahb clock cycles, and tcy is the time in ns for one ahb clock. the sig_done bit in fmstat can be polled by software to determine when signature generation is complete. after signature generation, a 32-bit signatur e can be read from the fmsw0 register. the 32-bit signature reflects the corrected data re ad from the flash and the flash parity bits and check bit values. 19.5.1.3 content verification the signature as it is read from the fmsw 0 register must be equal to the reference signature. the following pseudo-code show s the algorithm to derive the reference signature: sign = 0 for address = fmsstart.start to fmsstop.stopa { for i = 0 to 30{ nextsign[i] = f_q[addredd[i] xor sign[i + 1] nextsign[31] = f_q[address[31] xor sign[0] xor sign[10] xor sign[30] xor sign[31] sign = nextsign } } signature32 = sign
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 236 of 313 20.1 how to read this chapter the boot rom is identical for all lpc800 parts. 20.2 features ? 8 kb on-chip boot rom ? contains the boot loader with in-system programming (i sp) facility and the following apis: ? in application programming (iap) of flash memory ? power profiles for optimizing power consumption and system performance ? usart drivers ? i2c drivers 20.3 general description 20.3.1 boot loader the boot loader controls initial operation after reset and also provides the means to accomplish programming of the flash memory via usart. this could be initial programming of a blank device, erasure and re-programming of a previously programmed device, or programming of the flash memory by the application program in a running system. the boot loader code is executed every time the part is powered on or reset. the boot loader can execute the isp command handler or the user application code. a low level after reset at the pio0_1 pin is considered as an external hardware request to start the isp command handler via usart. for details on the b oot process, see section 20.4.3 ? boot process ? . remark: sram location 0x1000 0000 to 0x1000 0050 is not used by the bootloader and the memory content in this ar ea is retained during reset. sram memory is not retained when the part powers down or enters deep power-down mode. assuming that power supply pins are on th eir nominal levels when the rising edge on reset pin is generated, it may take up to 3 ms before pio0_1 is sampled and the decision whether to continue with user code or isp handler is made. if pio0_1 is sampled low and the watchdog overflow flag is set, the external hardware request to start the isp command handler is ignored. if there is no request for the isp command handler execution (pio0_1 is sampled high after reset), a search is made for a valid user program. if a valid user program is found then the execution control is transferred to it. if a valid user program is not found, the auto-baud routine is invoked. remark: the sampling of pin pio0_1 can be disabled through programming flash location 0x0000 02fc (see section 21.3.3 ? code read protection (crp) ? ). um10601 chapter 20: lpc800 boot rom rev. 1.0 ? 7 november 2012 preliminary user manual
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 237 of 313 nxp semiconductors um10601 chapter 20: lpc800 boot rom 20.3.2 rom-based apis once the part has booted, the user can access several apis located in the boot rom to access the flash memory, optimize power consumption, and operate the usart and i2c peripherals. the structure of the boot rom apis is shown in fig 34. boot rom structure table 211. api calls api description reference flash iap flash in-application programming table 234 power profiles api configure system clock and power consumption table 247 i2c driver i2c rom driver table 250 uart driver uart get memory size table 271 ()
(#

)6*+)
(%c"+

()
(#
+*6!+
%c"+
 +$+)*+'


()
(#
+*6!+
%c"+
 +$+)*+'
()
(#
+*6!+
%c"+
, +$+)*+' r
()
(#
+*6!+
%c"+
&
()
(#
;&!(6#&

()
(#
;&!(6#&
,
()
(#
;&!(6#&

r
()
(#
;&!(6#&
&
+*6!+
8 
')6*+)
)#;(6&+$
9;&!(6#&
(%c"+
+*6!+
&

)6*+)
%c"+
,2
 ()
(#


,2
, p,2, p,2 p,2 p,2, p,2 p,2 +*6!+
/ #:+)
5)#96"+$

9;&!(6#&
(%c"+ "%$7
 ()
(#
+*6!+
5#:+)
5)#96"+ 9;&!(6#&
(%c"+ ()
(#
+*6!+
%c"+
+$+)*+' ()
(#

')6*+)
)#;(6&+
9;&!(6#& (%c"+
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 238 of 313 nxp semiconductors um10601 chapter 20: lpc800 boot rom 20.4 functional description 20.4.1 boot pins when pin pio0_1 is pulled low on reset, the part enters isp mode and the isp command handler starts up. in isp mode, pins pio0_0 is connected to function u0_rxd and pin pio0_4 is connected to func tion u0_txd on the usart0 block. 20.4.2 memory map after any reset the boot block is 8 kb in size. the boot block is located in the memory region starting from the address 0x1fff 0000. the bootloader is designed to run from this memory area, but both the isp and iap software use part s of the on-chip ram. the ram usage is described later in this chapte r. the interrupt vectors residing in the boot block of the on-chip flash memory also become active af ter reset, i.e., the bo ttom 512 bytes of the boot block are also visible in the memory region starting from the address 0x0000 0000. 20.4.3 boot process during the boot process, the boot loader chec ks if there is valid user code in flash. the criterion for valid user code is as follows: the reserved cortex-m0+ except ion vector location 7 (offset 0x0000 001c in the vector table) should contain the 2?s complement of the check-sum of table entries 0 through 6. this causes the checksum of the first 8 table entries to be 0. the bootloader code checksums the first 8 locations in sector 0 of the flash. if the result is 0, then execution control is transferred to the user code. if the signature is not valid, the auto-baud routin e synchronizes with the host via serial port usart0. the host should send a ??? (0x3f) as a synchronization character and wait for a response. the host side serial port settings should be 8 data bits, 1 stop bit and no parity. the auto-baud routine measures the bit time of the received synchronization character in terms of its own frequency (the 12 mhz irc frequency) and programs the baud rate generator of the serial port. it also sends an ascii string ("synchr onized") to the host. in response, the host should send the same string ("synchronized"). the boot loader auto-baud routine looks at the received characters to verify synchronization. if synchro nization is verified then "ok " string is sent to the host. the host should respond by sending the cr ystal frequency (in khz) at which the part is running. the response is required for backward compatib ility of the boot loader code and, on the lpc800, is ignored. the boot loader configures the part to run at the 12 mhz irc frequency. once the crystal frequency response is rece ived, the part is in itialized and the isp command handler is invoked. for safety reasons an "unlock" command is required before executing the commands resulting in flash erase/write operations and the "go" command. the rest of the commands can be execut ed without the unlock command. the unlock command is required to be executed once per isp session. the unlock command is explained in table 218 ? uart isp unlock command ? .
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 239 of 313 nxp semiconductors um10601 chapter 20: lpc800 boot rom 20.4.4 boot process flowchart (1) this step is included for backward compatibility and the response is ignored by the boot loader. fig 35. boot process flowchart   m 4
  
l ab 



 
   /  s
  
 s /-  s
 
 s a,-
i
b 
 4s 
 4s    s 3 
  
  
  d+$ d+$ d+$ d+$ d+$ d+$ d+$ &# &# &# &# &# &# &# &#   c##(
9)#<

draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 240 of 313 21.1 how to read this chapter see ta b l e 2 1 2 for different flash configurations. 21.2 features ? in-system programming: in-system programming (isp) is programming or reprogramming the on-chip flash memory, using the bootloader software and uart serial port. ? in-application programming: in-application (iap) programming is performing erase and write operation on the on-chip flash memory, as directed by the end-user application code. ? you can use isp and iap when the pa rt resides in the end-user board. ? flash page write and erase supported. 21.3 general description 21.3.1 flash configuration most iap and isp commands operate on sectors and specify sector numbers. in addition a page erase command is supported. the following table shows the correspondence between page numbers, sector numbers, and memory addresses. the size of a sector is 1 kb and the size of a page is 64 byte. one sector contains 16 pages. um10601 chapter 21: lpc800 flash isp and iap programming rev. 1.0 ? 7 november 2012 preliminary user manual table 212. lpc800 flash configurations type number flash lpc810m021fn8 4 kb lpc811m001fdh16 8 kb lpc812m101fdh16 16 kb lpc812m101fd20 16 kb LPC812M101FDH20 16 kb table 213. lpc800 flash configuration sector number sector size [kb] page number address range 4 kb 8 kb 16 kb 0 1 0 -15 0x0000 0000 - 0x0000 03ff yes yes yes 1 1 16 - 31 0x0000 0400 - 0x0000 07ff yes yes yes 2 1 32 - 47 0x0000 0800 - 0x0000 0bff - yes yes 3 1 48 - 63 0x0000 0c00 - 0x0000 0fff - yes yes 4 1 64 - 79 0x0000 1000 - 0x0000 13ff - yes yes 5 1 80 - 95 0x0000 1400 - 0x0000 17ff - yes yes
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 241 of 313 nxp semiconductors um10601 chapter 21: lpc800 flash isp and iap programming 21.3.2 flash content protection mechanism the part is equipped with the error correc tion code (ecc) capable flash memory. the purpose of an error correction module is twofold: the ecc first decodes data words read from the memory into output data words. then, the ecc encodes data words to be written to the memory. the error correction capability consists of single bit error correction with hamming code. the operation of the ecc is transparent to th e running application. the ecc content itself is stored in a flash memory not accessible by the user?s code to either read from it or write into it on its own. 6 bit of ecc correspond s to every consecutive 32 bit of the user accessible flash. consequently, flash byte s from 0x0000 0000 to 0x0000 0003 are protected by the first 6 bit ecc, flash bytes from 0x0000 0004 to 0x0000 0007 are protected by the second 6-bit ecc byte, etc. whenever the cpu requests a read from the user accessible flash, both 32 bits of raw data containing the specified memory location and the matching ecc byte are evaluated. if the ecc mechanism detects a single error in the fetched data, a correction will be applied before data are provided to the cpu. when a write request into the user accessible flash is made, writing the user specified content is accompanied by a matching ecc value calculated and stored in the ecc memory. when a sector of flash memory is erased, the corresponding ecc bits are also erased. once a 6-bit ecc is written, it can not be up dated unless it is erased first. therefore, for the implemented ecc mechanism to perform properly, data must be written into the flash memory in groups of 4 bytes (or multiples of 4), aligned as described above. 21.3.3 code read protection (crp) code read protection is a mechanism that allo ws the user to enable different levels of security in the system so that access to the on-chip flash and use of the isp can be restricted. when needed, crp is invoked by programming a specific pattern in flash location at 0x0000 02fc. iap commands are not affected by the code read protection. 6 1 96 - 111 0x0000 1800 - 0x0000 1bff - yes yes 7 1 112 - 127 0x0000 1c00 - 0x0000 1fff - yes yes 8 1 128 - 143 0x0000 2000 - 0x0000 23ff - yes yes 9 1 144 - 159 0x0000 2400 - 0x0000 27ff yes yes yes 10 1 160 - 175 0x0000 2800 - 0x0000 2bff yes yes yes 11 1 176 - 191 0x0000 2c00 - 0x0000 2fff yes yes yes 12 1 192 - 207 0x0000 3000 - 0x0000 33ff yes yes yes 13 1 208 - 223 0x0000 3400 - 0x0000 37ff yes yes yes 14 1 224 - 239 0x0000 3800 - 0x0000 3bff yes yes yes 15 1 240 - 255 0x0000 3c00 - 0x0000 3fff yes yes yes table 213. lpc800 flash configuration sector number sector size [kb] page number address range 4 kb 8 kb 16 kb
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 242 of 313 nxp semiconductors um10601 chapter 21: lpc800 flash isp and iap programming important: any crp change becomes effective only after the device has gone through a power cycle. table 214. code read protection options name pattern programmed in 0x0000 02fc description no_isp 0x4e69 7370 prevents sampling of pin pio0_1 for entering isp mode. pio0_1 is available for other uses. crp1 0x12345678 access to chip via the swd pins is disabl ed. this mode allows partial flash update using the following isp commands and restrictions: ? write to ram command should not access ram below 0x1000 0300. access to addresses below 0x1000 0200 is disabled. ? copy ram to flash command can not write to sector 0. ? erase command can erase sector 0 only wh en all sectors are selected for erase. ? compare command is disabled. ? read memory command is disabled. this mode is useful when crp is required a nd flash field updates are needed but all sectors can not be erased. since compare command is disabled in case of partial updates the secondary loader should implemen t checksum mechanism to verify the integrity of the flash. crp2 0x87654321 access to chip via the swd pins is disabled. the following isp commands are disabled: ? read memory ? write to ram ? go ? copy ram to flash ? compare when crp2 is enabled the isp erase command onl y allows erasure of all user sectors. crp3 0x43218765 access to chip via the swd pins is dis abled. isp entry by pulling pi o0_1 low is disabled if a valid user code is present in flash sector 0. this mode effectively disables isp override using pio0_1 pin. it is up to the user?s application to provide a flash update mechanism using iap ca lls or call reinvoke isp command to enable flash update via uart. caution: if crp3 is selected, no future factory testing can be performed on the device. table 215. code read protection hardware/software interaction crp option user code valid pio0_1 pin at reset swd enabled part enters isp mode partial flash update in isp mode none no x yes yes yes none yes high yes no na none yes low yes yes yes crp1 yes high no no na crp1 yes low no yes yes crp2 yes high no no na crp2 yes low no yes no crp3yesx nonona crp1 no x no yes yes crp2 no x no yes no crp3 no x no yes no
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 243 of 313 nxp semiconductors um10601 chapter 21: lpc800 flash isp and iap programming in case a crp mode is enabled and access to the chip is allowed via the isp, an unsupported or restrict ed isp command will be te rminated with return code code_read_protection_enabled. 21.3.3.1 isp entry protection in addition to the three crp modes, the user can prevent the sampling of pin pio0_1 for entering isp mode and thereby release pin pio0_1 for other uses. this is called the no_isp mode. the no_isp mode can be entered by programming the pattern 0x4e69 7370 at location 0x0000 02fc. 21.4 api description 21.4.1 uart isp commands the following commands are accepted by the isp command handler. detailed status codes are supported for each command. the command handler sends the return code invalid_command when an undefined command is received. commands and return codes are in ascii format. cmd_success is sent by isp command handl er only when receiv ed isp command has been completely executed and the new isp command can be given by the host. exceptions from this rule are "set baud rate ", "write to ram", "read memory", and "go" commands. table 216. isp commands allowed for different crp levels isp command crp1 crp2 crp3 (no entry in isp mode allowed) unlock yes yes n/a set baud rate yes yes n/a echo yes yes n/a write to ram yes; above 0x1000 0300 only no n/a read memory no no n/a prepare sector(s) for write operation yes yes n/a copy ram to flash yes; not to sector 0 no n/a go no no n/a erase sector(s) yes; sector 0 can only be erased when all sectors are erased. yes; all sectors only n/a blank check sector(s) no no n/a read part id yes yes n/a read boot code version yes yes n/a compare no no n/a readuid yes yes n/a
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 244 of 313 nxp semiconductors um10601 chapter 21: lpc800 flash isp and iap programming 21.4.1.1 unlock 21.4.1.2 set baud rate table 217. uart isp command summary isp command usage described in unlock u table 218 set baud rate b table 219 echo a table 220 write to ram w table 221 read memory r
table 222 prepare sector(s) for write operation p table 223 copy ram to flash c table 224 go g
table 225 erase sector(s) e table 226 blank check sector(s) i table 227 read part id j table 228 read boot code version k table 230 compare m table 231 readuid n table 232 table 218. uart isp unlock command command u input unlock code: 23130 10 return code cmd_success | invalid_code | param_error description this command is used to unlock flash write, erase, and go commands. example "u 23130" unlocks the flash write/erase & go commands. table 219. uart isp set baud rate command command b input baud rate: 9600 | 19200 | 38400 | 57600 | 115200 stop bit: 1 | 2 return code cmd_success | invalid_baud_rate | invalid_stop_bit | param_error description this command is used to change the baud rate. the new baud rate is effective after the command handler send s the cmd_success return code. example "b 57600 1" sets the serial port to baud rate 57600 bps and 1 stop bit.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 245 of 313 nxp semiconductors um10601 chapter 21: lpc800 flash isp and iap programming 21.4.1.3 echo 21.4.1.4 write to ram the host should send the pl ain binary code after receiv ing the cmd_success return code. this isp command handler responds wi th ?ok? when the transfer has finished. 21.4.1.5 read memory
reads the the plain binary code of the data stream, followed by the cmd_success return code. table 220. uart isp echo command command a input setting: on = 1 | off = 0 return code cmd_success | param_error description the default setting for echo comma nd is on. when on the isp command handler sends the received serial data back to the host. example "a 0" turns echo off. table 221. uart isp write to ram command command w input start address: ram address where data bytes are to be written. this address should be a word boundary. number of bytes: number of bytes to be written. count should be a multiple of 4 return code cmd_success | addr_error (address not on word boundary) | addr_not_mapped | count_error (byte count is not multiple of 4) | param_error | code_read_protection_enabled description this command is used to download data to ram. this command is blocked when code read protection levels 2 or 3 are enabled. writing to addresses below 0x1000 0300 is disabled for crp1. example "w 268436224 4" writes 4 bytes of data to address 0x1000 0300.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 246 of 313 nxp semiconductors um10601 chapter 21: lpc800 flash isp and iap programming 21.4.1.6 prepare sector(s) for write operation this command makes flash write/erase operation a two step process. 21.4.1.7 copy ram to flash when writing to the flash, the following limitations apply: 1. the smallest amount of data that can be written to flash by the copy ram to flash command is 64 byte (equal to one page). 2. one page consists of 16 flash words (lines), and the smallest amount that can be modified per flash write is one flash word (one line). this limitat ion follows from the application of ecc to the flash write operation, see section 21.3.2 . 3. to avoid write disturbance (a mechanism intr insic to flash memories), an erase should be performed after following 16 consecutive writes inside the same page. note that the erase operation then erases the entire sector. remark: once a page has been written to 16 times, it is still possible to write to other pages within the same sector without performing a sector erase (assuming that those pages have been erased previously). table 222. uart isp read memory command command r input start address: address from where data bytes are to be read. this address should be a word boundary. number of bytes: number of bytes to be read. count should be a multiple of 4. return code cmd_success followed by | addr_error (address not on word boundary) | addr_not_mapped | count_error (byte count is not a multiple of 4) | param_error | code_read_protection_enabled description this command is used to read data from ram or flash memory. this command is blocked when code read protection is enabled. example "r 268435456 4" reads 4 byt es of data from address 0x1000 0000. table 223. uart isp prepare sector( s) for write operation command command p input start sector number end sector number: should be greater than or equal to start sector number. return code cmd_success | busy | invalid_sector | param_error description this command must be executed before executing "copy ram to flash" or "erase sector(s)" command. successful execution of the "copy ram to flash" or "erase sector(s)" command causes relevant sectors to be protected again. the boot block can not be prepared by this command. to prepare a single sector use the same "start" and "end" sector numbers. example "p 0 0" prepares the flash sector 0.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 247 of 313 nxp semiconductors um10601 chapter 21: lpc800 flash isp and iap programming 21.4.1.8 go
table 224. uart isp copy ram to flash command command c input flash address (dst): destination flash address where data bytes are to be written. the destination address should be a 64 byte boundary. ram address (src): source ram address from where data bytes are to be read. number of bytes: number of bytes to be written. should be 64 | 128 | 256 | 512 | 1024. return code cmd_success | src_addr_error (address not on word boundary) | dst_addr_error (address not on correct boundary) | src_addr_not_mapped | dst_addr_not_mapped | count_error (byte count is not 64 | 128 | 256 | 512 | 1024) | sector_not_prepared_for write_operation | busy | cmd_locked | param_error | code_read_protection_enabled description this command is used to program the flash memory. the "p repare sector(s) for write operation" command should preced e this command. the affected sectors are automatically protected again once the copy command is successfully executed. the boot block cannot be written by this command. this command is blocked when code read protection is enabled. example "c 0 268467504 512" copies 512 bytes from the ram address 0x1000 0800 to the flash address 0. table 225. uart isp go command command g input address: flash or ram address from which the code execution is to be started. this address should be on a word boundary. mode: t (execute progra m in thumb mode). return code cmd_success | addr_error | addr_not_mapped | cmd_locked | param_error | code_read_protection_enabled description this command is used to execute a program residing in ram or flash memory. it may not be possible to return to the isp command handler once this command is successfully executed. this command is blocked when code read protection is enabled. the command must be used wit h an address of 0x0000 0200 or greater. example "g 512 t" branches to address 0x0000 0200 in thumb mode.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 248 of 313 nxp semiconductors um10601 chapter 21: lpc800 flash isp and iap programming 21.4.1.9 erase sector(s) 21.4.1.10 blank check sector(s) 21.4.1.11 read part identification number table 226. uart isp erase sector command command e input start sector number end sector number: should be greater than or equal to start sector number. return code cmd_success | busy | invalid_sector | sector_not_prepared_for_write_operation | cmd_locked | param_error | code_read_protection_enabled description this command is used to erase one or more sector(s) of on-chip flash memory. the boot block can not be erased using this command. this command only allows erasure of all user sectors when t he code read protection is enabled. example "e 2 3" erases the flash sectors 2 and 3. table 227. uart isp blank check sector command command i input start sector number: end sector number: should be greater than or equal to start sector number. return code cmd_success | sector_not_blank (followed by ) | invalid_sector | param_error description this command is used to blank check one or more sectors of on-chip flash memory. blank check on sector 0 always fails as first 64 bytes are re-mapped to flash boot block. when crp is enabled, the blank check command returns 0 for the offset and value of sectors which are not blank. blank sector s are correctly reported irrespective of the crp setting. example "i 2 3" blank c hecks the flash sectors 2 and 3. table 228. uart isp read pa rt identification command command j input none. return code cmd_succ ess followed by part identification number in ascii (see table 229 ). description this command is used to read the part identification number.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 249 of 313 nxp semiconductors um10601 chapter 21: lpc800 flash isp and iap programming 21.4.1.12 read boot code version number 21.4.1.13 compare 21.4.1.14 readuid table 229. part identification numbers device hex coding lpc810m021fn8 0x0000 8100 lpc811m001fdh16 0x0000 8110 lpc812m101fdh16 0x0000 8120 lpc812m101fd20 0x0000 8121 LPC812M101FDH20 0x0000 8122 table 230. uart isp read boot code version number command command k input none return code cmd_success fo llowed by 2 bytes of boot code version number in ascii format. it is to be interpreted as .. description this command is used to read the boot code version number. table 231. uart isp compare command command m input address1 (dst): starting flash or ram address of data bytes to be compared. this address should be a word boundary. address2 (src): starting flash or ram address of data bytes to be compared. this address should be a word boundary. number of bytes: number of bytes to be compared; should be a multiple of 4. return code cmd_success | (sourc e and destination data are equal) compare_error | (followed by the offset of first mismatch) count_error (byte count is not a multiple of 4) | addr_error | addr_not_mapped | param_error description this command is used to compare the memory contents at two locations. example "m 8192 268468224 4" comp ares 4 bytes from the ram address 0x1000 8000 to the 4 bytes from the flash address 0x2000. table 232. uart isp readuid command command n input none return code cmd_success fo llowed by four 32-bit words of e-sort test information in ascii format. the word sent at the lowest address is sent first. description this command is used to read the unique id.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 250 of 313 nxp semiconductors um10601 chapter 21: lpc800 flash isp and iap programming 21.4.1.15 uart isp return codes 21.4.2 iap commands for in application programming the iap routine should be called with a word pointer in register r0 pointing to memory (ram) containing command code and parameters. result of the iap command is returned in the result table pointed to by register r1. the user can reuse the command table for result by passing the same pointer in registers r0 and r1. the parameter table should be big enough to hold all the results in case the number of results are more than number of parameters. parameter passing is illustrated in the figure 36 . the number of parameters and results vary according to the iap command. the maximum number of parameters is 5, passed to the "copy ram to flash" command. the maximum number of results is 4, returned by the "readuid" command. the table 233. uart isp return codes summary return code mnemonic description 0 cmd_success command is executed successfully. sent by isp handler only when command given by the host has been completely and successfully executed. 1 invalid_command invalid command. 2 src_addr_error source address is not on word boundary. 3 dst_addr_error destination addres s is not on a correct boundary. 4 src_addr_not_mapped source address is not mapped in the memory map. count value is taken in to consideration where applicable. 5 dst_addr_not_mapped destination addres s is not mapped in the memory map. count value is tak en in to consideration where applicable. 6 count_error byte count is not multiple of 4 or is not a permitted value. 7 invalid_sector sector number is invalid or end sector number is greater than start sector number. 8 sector_not_blank sector is not blank. 9 sector_not_prepared_for_ write_operation command to prepare sector for write operation was not executed. 10 compare_error source and destination data not equal. 11 busy flash programming hardware interface is busy. 12 param_error insufficient number of parameters or invalid parameter. 13 addr_error address is not on word boundary. 14 addr_not_mapped address is not mapped in the memory map. count value is taken in to consideration where applicable. 15 cmd_locked command is locked. 16 invalid_code unlock code is invalid. 17 invalid_baud_rate invalid baud rate setting. 18 invalid_stop_bit invalid stop bit setting. 19 code_read_protection_ enabled code read protection enabled.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 251 of 313 nxp semiconductors um10601 chapter 21: lpc800 flash isp and iap programming command handler sends the status code invalid_command when an undefined command is received. the iap routine reside s at 0x1fff 1ff0 location and it is thumb code. the iap function could be called in the following way using c. define the iap location entry point. since the 0t h bit of the iap location is set there will be a change to thumb instruction set when the program counter branches to this address. #define iap_location 0x1fff1ff1 define data structure or pointers to pass i ap command table and result table to the iap function: unsigned long command[5]; unsigned long result[4]; or unsigned long * command; unsigned long * result; command=(unsigned long *) 0x... result= (unsigned long *) 0x... define pointer to function type, which takes tw o parameters and return s void. note the iap returns the result with the base address of the table residing in r1. typedef void (*iap)(unsigned int [],unsigned int[]); iap iap_entry; setting function pointer: iap_entry=(iap) iap_location; whenever you wish to call iap you could use the following statement. iap_entry (command, result); as per the arm specification (the arm thumb procedure call standard sws espc 0002 a-05) up to 4 parameters can be passed in the r0, r1, r2 and r3 registers respectively. additional parame ters are passed on the stack. up to 4 parameters can be returned in the r0, r1, r2 and r3 registers respectively. additional parameters are returned indirectly via memory. some of the iap calls require more than 4 parameters. if the arm suggested scheme is used for the paramete r passing/returning then it might create problems due to difference in the c compiler implementation from different vendors. the suggested parameter passing scheme reduces such risk. the flash memory is not accessible during a write or erase operation. iap commands, which results in a flash write/erase operation, use 32 bytes of space in the top portion of the on-chip ram for execution. the user program should not be use this space if iap flash programming is permitted in the application.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 252 of 313 nxp semiconductors um10601 chapter 21: lpc800 flash isp and iap programming 21.4.2.1 prepare sector(s) for write operation (iap) this command makes flash write/erase operation a two step process. table 234. iap command summary iap command command code described in prepare sector(s) for write operation 50 (decimal) table 235 copy ram to flash 51 (decimal) table 236 erase sector(s) 52 (decimal) table 237 blank check sector(s) 53 (decimal) table 238 read part id 54 (decimal) table 239 read boot code version 55 (decimal) table 240 compare 56 (decimal) table 241 reinvoke isp 57 (decimal) table 242 read uid 58 (decimal) table 243 erase page 59 (decimal) table 244 fig 36. iap parameter passing 
  
  
  
&   
 
 
 
& !#<<%&' 5%)%<+(+)
(%c"+ !#<<%&' )+$;"(
(%c"+ 
 
), 
 
) table 235. iap prepare sector(s) for write operation command command prepare sector(s) for write operation input command code: 50 (decimal) param0: start sector number param1: end sector number (should be greater than or equal to start sector number).
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 253 of 313 nxp semiconductors um10601 chapter 21: lpc800 flash isp and iap programming 21.4.2.2 copy ram to flash (iap) see section 21.4.1.4 for limitations on the write-to-flash process. return code cmd_success | busy | invalid_sector result none description this command must be executed before executing "copy ram to flash" or "erase sector(s)" command. successful execution of the "copy ram to flash" or "erase sector(s)" command causes relevant sectors to be protected again. the boot sector can not be prepared by this command. to prepare a single sector use the same "start" and "end" sector numbers. table 235. iap prepare sector(s) for write operation command command prepare sector(s) for write operation table 236. iap copy ram to flash command command copy ram to flash input command code: 51 (decimal) param0(dst): destination flash address where da ta bytes are to be written. this address should be a 64 byte boundary. param1(src): source ram address from which data bytes are to be read. this address should be a word boundary. param2: number of bytes to be written. should be 64 | 128 | 256 | 512 | 1024. param3: system clock frequency (cclk) in khz. return code cmd_success | src_addr_error (address not a word boundary) | dst_addr_error (address not on correct boundary) | src_addr_not_mapped | dst_addr_not_mapped | count_error (byte count is not 256 | 512 | 1024 | 4096) | sector_not_prepared_for_write_operation | busy result none description this command is used to program the flash memory. the affected sectors should be prepared first by calling "prepare sect or for write operation" command. the affected sectors are automatically prot ected again once the copy command is successfully executed. the boot sector can not be written by this command.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 254 of 313 nxp semiconductors um10601 chapter 21: lpc800 flash isp and iap programming 21.4.2.3 erase sector(s) (iap) 21.4.2.4 blank check sector(s) (iap) 21.4.2.5 read part identification number (iap) table 237. iap erase sector(s) command command erase sector(s) input command code: 52 (decimal) param0: start sector number param1: end sector number (should be greater than or equal to start sector number). param2: system clock frequency (cclk) in khz. return code cmd_success | busy | sector_not_prepared_for_write_operation | invalid_sector result none description this command is used to erase a se ctor or multiple sectors of on-chip flash memory. the boot sector can not be erased by this command. to erase a single sector use the same "start" and "end" sector numbers. table 238. iap blank check sector(s) command command blank check sector(s) input command code: 53 (decimal) param0: start sector number param1: end sector number (should be greater than or equal to start sector number). return code cmd_success | busy | sector_not_blank | invalid_sector result result0: offset of the first non blank word location if the status code is sector_not_blank. result1: contents of non blank word location. description this command is used to blank check a sector or multiple sectors of on-chip flash memory. to blank check a single sector use the same "start" and "end" sector numbers. table 239. iap read part identification command command read part identification number input command code: 54 (decimal) parameters: none return code cmd_success result result0: part identification number. description this command is used to read the part identification number.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 255 of 313 nxp semiconductors um10601 chapter 21: lpc800 flash isp and iap programming 21.4.2.6 read boot code version number (iap) 21.4.2.7 compare (iap) table 240. iap read boot code version number command command read boot code version number input command code: 55 (decimal) parameters: none return code cmd_success result result0: 2 bytes of boot code version number. read as .< byte0(minor)> description this command is used to read the boot code version number. table 241. iap compare command command compare input command code: 56 (decimal) param0(dst): starting flash or ram address of data bytes to be compared. this address should be a word boundary. param1(src): starting flash or ram address of data bytes to be compared. this address should be a word boundary. param2: number of bytes to be compar ed; should be a multiple of 4. return code cmd_success | compare_error | count_error (byte count is not a multiple of 4) | addr_error | addr_not_mapped result result0: offset of the first mismatch if the status code is compare_error. description this command is used to compare the memory contents at two locations.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 256 of 313 nxp semiconductors um10601 chapter 21: lpc800 flash isp and iap programming 21.4.2.8 reinvoke isp (iap) 21.4.2.9 readuid (iap) 21.4.2.10 erase page 21.4.2.11 iap status codes table 242. iap reinvoke isp command compare input command code: 57 (decimal) return code none result none. description this command is used to invoke the bootloader in isp mode. it maps boot vectors, sets pclk = cclk, and configures usart0 pins u0_rxd and u0_txd. this command may be used when a valid user program is present in the internal flash memory and the pio0_1 pin is not accessible to force the isp mode. table 243. iap readuid command command compare input command code: 58 (decimal) return code cmd_success result result0: the first 32-bit word (at the lowest address). result1: the second 32-bit word. result2: the third 32-bit word. result3: the fourth 32-bit word. description this command is used to read the unique id. table 244. iap erase page command command erase page input command code: 59 (decimal) param0: start page number. param1: end page number (should be greater than or equal to start page) param2: system clock frequency (cclk) in khz. return code cmd_success | busy | sector_not_prepared_for_write_operation | invalid_sector result none description this command is used to erase a page or multiple pages of on-chip flash memory. to erase a single page use the same "start" and "end" page numbers. table 245. iap status codes summary status code mnemonic description 0 cmd_success command is executed successfully. 1 invalid_command invalid command. 2 src_addr_error source address is not on a word boundary. 3 dst_addr_error destination address is not on a correct boundary.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 257 of 313 nxp semiconductors um10601 chapter 21: lpc800 flash isp and iap programming 21.5 functional description 21.5.1 uart commun ication protocol all uart isp commands should be sent as single ascii strings. strings should be terminated with carriage return (cr) and/or line feed (lf) control characters. extra and characters are ignored. all isp responses are sent as terminated ascii strings. da ta is sent and received in plain binary format. 21.5.1.1 uart isp command format "command parameter_0 parameter_1 ... parameter_n" "data" (data only for write commands). 21.5.1.2 uart isp response format "return_coderesponse_0response_1 ... response_n" "data" (data only for read commands). 21.5.1.3 uart isp data format the data stream is in plain binary format. 21.5.2 memory and interr upt use for isp and iap 21.5.2.1 interrupts during uart isp the boot block interrupt vectors located in the boot block of the flash are active after any reset. 4 src_addr_not_mapped source address is not mapped in the memory map. count value is taken in to consideration where applicable. 5 dst_addr_not_mapped destination address is not mapped in the memory map. count value is taken in to consideration where applicable. 6 count_error byte count is not multiple of 4 or is not a permitted value. 7 invalid_sector sector number is invalid. 8 sector_not_blank sector is not blank. 9 sector_not_prepared_ for_write_operation command to prepare sector for write operation was not executed. 10 compare_error source and destination data is not same. 11 busy flash programming hardware interface is busy. table 245. iap status codes summary status code mnemonic description
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 258 of 313 nxp semiconductors um10601 chapter 21: lpc800 flash isp and iap programming 21.5.2.2 interrupts during iap the on-chip flash memory is not accessible du ring erase/write operations. when the user application code starts executing the interrupt vectors from the user flash area are active. before making any iap call, either disable the interrupts or ensure that the user interrupt vectors are active in ram and that the inte rrupt handlers reside in ram. the iap code does not use or disable interrupts. 21.5.2.3 ram used by isp command handler the stack of isp commands is located at 0x1000 0270. the maximum stack usage is 540 byte and grows downwards. 21.5.2.4 ram used by iap command handler the maximum stack usage in the user allocated stack space is 148 bytes and grows downwards. 21.5.3 debugging 21.5.3.1 comparing flash images depending on the debugger used and the ide d ebug settings, the memory that is visible when the debugger connects might be the boot rom, the internal sram , or the flash. to help determine which memory is present in the current debug environment, check the value contained at flash address 0x0000 0004. this address contains the entry point to the code in the arm cortex-m0+ vector table, which is the bottom of the boot rom, the internal sram, or the flash memory respectively. 21.5.3.2 serial wire debug (swd) flash programming interface debug tools can write parts of the flash im age to ram and then execute the iap call "copy ram to flash" repeatedly with proper offset. table 246. memory mapping in debug mode memory mapping mode memory start address visible at 0x0000 0004 bootloader mode 0x1fff 0000 user flash mode 0x0000 0000 user sram mode 0x1000 0000
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 259 of 313 22.1 how to read this chapter the power profiles are available for all lpc800 parts. 22.2 features ? includes rom-based application services ? power management services ? clocking services 22.3 general description the power consumption in active and sleep modes can be optimized for the application through simple calls to the power profile. the power configuration routine configures the lpc800 for one of the following power modes: ? default mode corresponding to power configuration after reset. ? cpu performance mode co rresponding to optimize d processing capability. ? efficiency mode corresponding to optimize d balance of current consumption and cpu performance. ? low-current mode corresponding to lowest power consumption. in addition, the power profile includes routin es to select the optimal pll settings for a given system clock and pll input clock. remark: disable all interrupts befo re making calls to the power profile api. you can re-enable the interrupts after the power profile api calls have completed. the api calls to the rom are performed by executing functions which are pointed by a pointer within the rom driver table. figure 37 shows the pointer structure used to call the power profiles api. um10601 chapter 22: lpc800 power profile api rom driver rev. 1.0 ? 7 november 2012 preliminary user manual
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 260 of 313 nxp semiconductors um10601 chapter 22: lpc800 power profile api rom driver 22.4 api description the power profile api provides functions to configure the system clock and optimize the system setting for lowe st power consumption. fig 37. power profiles pointer structure
()
(#

)6*+)
(%c"+

()
(#
+*6!+
%c"+



()
(#
+*6!+
%c"+

()
(#
+*6!+
%c"+
, r
()
(#
+*6!+
%c"+
&
$+(-5""
$+(-5#:+)

#:+)

9;&!(6#&
(%c"+

)6*+)
%c"+
,2
 p,2,, p,2, p,2, p,2, ()
(#
#:+)
%c"+ fig 38. lpc800 clock configuration for power api use  
 6)!-#$!-!" $d$-#$!-!"  6)!-#$!-!" :'(-#$!-!"     4    .1 a
+&%c"+b    .&1 a&
+&%c"+b  4 +)657+)%"$ <%6&
!"#! $d$(+<
!"#! $d$-5""!" 6& $d$-5""!" #;( <   3,  &   4
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 261 of 313 nxp semiconductors um10601 chapter 22: lpc800 power profile api rom driver the following elements have to be defined in an application that uses the power profiles: typedef struct _pwrd { void (*set_pll)(unsigned int cmd[], unsigned int resp[]); void (*set_power)(unsigned int cmd[], unsigned int resp[]); } pwrd; typedef struct _rom { const pwrd * pwrd; } rom; rom ** rom = (rom **) (0x1fff1ff8 + 3 * sizeof(rom**)); unsigned int command[4], result[2]; 22.4.1 set_pll this routine sets up the system pll accordin g to the calling argument s. if the expected clock can be obtained by simply dividing the system pll input, set_pll bypasses the pll to lower system power consumption. remark: before this routine is invoked, the pll clock source (irc/system oscillator) must be selected ( table 13 ), the main clock source must be set to the input clock to the system pll ( table 8 ) and the system/ahb clock divider must be set to 1 ( ta b l e 1 5 ). set_pll attempts to find a pll setup that matches the calling parameters. once a combination of a feedback divider value (syspllctrl, m), a post divider ratio (syspllctrl, p) and the system/ahb clock divider (sysahbclkdiv) is found, set_pll applies the selected values and switches the main clock source selection to the system pll clock out (if necessary). the routine returns a result code that indi cates if the system pl l was successfully set (pll_cmd_success) or not (in wh ich case the result code id entifies what went wrong). the current system frequency value is also returned. the application should use this information to adjust other clocks in the de vice (the ssp, uart, and wdt clocks, and/or clockout). the following definitions are needed when making set_pll power routine calls: /* set_pll mode options */ table 247. power profile api calls api call description reference set_pll(command, result) pow er api set pll routine table 248 set_power(command, result) power api set power routine table 249 table 248. set_pll routine routine set_pll input param0: system pll input frequency (in khz) param1: expected system clock (in khz) param2: mode (cpu_freq_equ, cpu_ freq_lte, cpu_freq_gte, cpu_freq_approx) param3: system pll lock time-out result result0: pll_cmd_success | pll_invalid_ freq | pll_invalid_mode | pll_freq_not_found | pll_not_locked result1: system clock (in khz)
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 262 of 313 nxp semiconductors um10601 chapter 22: lpc800 power profile api rom driver #define cpu_freq_equ 0 #define cpu_freq_lte 1 #define cpu_freq_gte 2 #define cpu_freq_approx 3 /* set_pll result0 options */ #define pll_cmd_success 0 #define pll_in va l i d _ f r e q 1 #define pll_invalid_mode 2 #define pll_freq_not_found 3 #define pll_not_locked 4 for a simplified clock configuration scheme see figure 38 . for more details see figure 3 . 22.4.1.1 param0: system pll input frequency and param1: expected system clock set_pll looks for a setup in which the system pll clock does not exceed 50 mhz. it easily finds a solution when the ratio between th e expected system clock and the system pll input frequency is an integer value, but it can also find solutions in other cases. the system pll input frequency ( param0 ) must be between 10000 to 25000 khz (10 mhz to 25 mhz) inclusive. the expected system clock ( param1 ) must be between 1 and 50000 khz inclusive. if either of these requirements is not met, set_pll returns pll_invalid_freq and returns param0 as result1 since the pll setting is unchanged. 22.4.1.2 param2: mode the first priority of set_pll is to find a setup that generates the system clock at exactly the rate specified in param1 . if it is unlikely that an exact match can be found, input parameter mode ( param2 ) should be used to specify if the actu al system clock can be less than or equal, greater than or equal or approximatel y the value specified as the expected system clock ( param1 ). a call specifying cpu_freq_equ will only succeed if th e pll can output exactly the frequency requested in param1 . cpu_freq_lte can be used if the requested frequency should not be exceeded (such as overall current consumption and/or power budget reasons). cpu_freq_gte helps applications that nee d a minimum level of cpu processing capabilities. cpu_freq_approx results in a system clock that is as close as possible to the requested value (it may be greater than or less than the requested value). if an illegal mode is specified, set_pll returns pll_invalid_mode. if the expected system clock is out of the range supported by this routine, set_pll returns pll_freq_not_found. in these cases the current pll setting is not changed and param0 is returned as result1 .
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 263 of 313 nxp semiconductors um10601 chapter 22: lpc800 power profile api rom driver 22.4.1.3 param3: system pll lock time-out it should take no more than 100 ? s for the system pll to lock if a valid configuration is selected. if param3 is zero, set_pll will wait indefinitely for t he pll to lock. a non-zero value indicates how many times the code will check for a successful pll lock event before it returns pll_not_locked. in this case the pll settings are unchanged and param0 is returned as result1 . remark: the time it takes the pll to lock depends on the selected pll input clock source (irc/system oscillator) and its characteristics. the selected source can experience more or less jitter depending on the operating conditions such as power supply and/or ambient temperature. this is why it is suggested that when a good known clock source is used and a pll_not_locked response is received , the set_pll routine should be invoked several ti mes before declaring the selected pll clock source invalid. hint: setting param3 equal to the system pll frequency [hz] divided by 10000 will provide more than enough pll lock-polling cycles. 22.4.2 set_power this routine configures the de vice?s internal power control settings according to the calling arguments. the goal is to reduce active pow er consumption while ma intaining the feature of interest to the application close to its optimum. remark: the set_power routine was designed for systems employing the configuration of sysahbclkdiv = 1 (system clock divider register, see ta b l e 1 7 and figure 38 ). using this routine in an application with the system cl ock divider not equal to 1 might not improve microcontroller?s performance as much as in setups when the main clock and the system clock are running at the same rate. set_power returns a result code that reports whether the power setting was successfully changed or not.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 264 of 313 nxp semiconductors um10601 chapter 22: lpc800 power profile api rom driver the following definitions are needed for set_power routine calls: /* set_power mode options */ #define pwr_default 0 #define pwr_cpu_performance 1 #define pwr_efficiency 2 #define pwr_low_current 3 /* set_power result0 options */ #define pwr_cmd_success 0 #define pwr_invalid_freq 1 #define pwr_invalid_mode 2 fig 39. power profiles usage ;$6&=
5#:+)
5)#96"+$
%&'
!7%&=6&=
$d$(+<
!"#! !;))+&(-!"#!  &+:-!"#! 
&+:-<#'+ ;$+
5#:+)
)#;(6&+
!%"" (#
!7%&=+
<#'+
(#
 ;$+
+6(7+)
!"#! 6&=
)#;(6&+
!%""
#)
!;$(#<
!#'+
(#
!7%&=+
$d$(+<
!"#!
9)#<
!;))+&(-!"#!
(#
&+:-!"#! ;$+
5#:+)
)#;(6&+
!%"" (#
!7%&=+
<#'+
(#
&+:-<#'+ +&' table 249. set_power routine routine set_power input param0: main clock (in mhz) param1: mode (pwr_default, pwr_cpu_performance, pwr_ efficiency, pwr_low_current) param2: system clock (in mhz) result result0: pwr_cmd_success | pw r_invalid_freq | pwr_invalid_mode
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 265 of 313 nxp semiconductors um10601 chapter 22: lpc800 power profile api rom driver for a simplified clock configuration scheme see figure 38 . for more details see figure 3 . 22.4.2.1 param0: main clock the main clock is the clock rate the microcon troller uses to source the system?s and the peripherals? clock. it is configured by either a successful execution of the clocking routine call or a similar code provided by the user. this operand must be an integer between 1 to 50 mhz inclusive. if a value out of this range is supplied, set_power returns pwr_invalid_freq and does not change the power control system. 22.4.2.2 param1: mode the input parameter mode ( param1 ) specifies one of four available power settings. if an illegal selection is provided, set_power returns pwr_invalid_mode and does not change the power control system. pwr_default keeps the device in a baseline power setting similar to its reset state. pwr_cpu_performance configures the microc ontroller so that it can provide more processing capability to the application. cp u performance is 30% be tter than the default option. pwr_efficiency setting was designed to find a balance between active current and the cpu?s ability to execute code and process data. in this mode the device outperforms the default mode both in terms of providing higher cpu performance and lowering active current. pwr_low_current is intended for those solutions that focus on lowering power consumption rather than cpu performance. 22.4.2.3 param2: system clock the system clock is the clock rate at whic h the microcontroller co re is running when set_power is called. this parameter is an integer between from 1 and 50 mhz inclusive. 22.5 functional description 22.5.1 clock control see section 22.5.1.1 to section 22.5.1.6 for examples of the clock control api. 22.5.1.1 invalid frequency (device maximum clock rate exceeded) command[0] = 12000; command[1] = 60000; command[2] = cpu_freq_equ; command[3] = 0; (*rom)->pwrd->set_pll(command, result); the above code specifies a 12 mhz pll in put clock and a system clock of exactly 60 mhz. the application was ready to infinitely wait for the pll to lock. but the expected system clock of 60 mhz exceeds the maximum of 50 mhz. therefore set_pll returns pll_invalid_freq in result[0] and 12000 in result[1] without changing the pll settings.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 266 of 313 nxp semiconductors um10601 chapter 22: lpc800 power profile api rom driver 22.5.1.2 invalid frequency selection (system clock divider restrictions) command[0] = 12000; command[1] = 40; command[2] = cpu_freq_lte; command[3] = 0; (*rom)->pwrd->set_pll(command, result); the above code specifies a 12 mhz pll input clock, a system clock of no more than 40 khz and no time-out while wa iting for the pll to lock. since the maximum divider value for the system clock is 255 and running at 40 khz would need a divide by value of 300, set_pll returns pll_invalid_freq in result[0] and 12000 in result[1] without changing the pll settings. 22.5.1.3 exact solution cannot be found (pll) command[0] = 12000; command[1] = 25000; command[2] = cpu_freq_equ; command[3] = 0; (*rom)->pwrd->set_pll(command, result); the above code specifies a 12 mhz pll in put clock and a system clock of exactly 25 mhz. the application was ready to infinitely wait for the pll to lock. since there is no valid pll setup within earlie r mentioned restrictions, set_pll returns pll_freq_not_found in result[0] and 12000 in result[1] without changing the pll settings. 22.5.1.4 system clock less than or equal to the expected value command[0] = 12000; command[1] = 25000; command[2] = cpu_freq_lte; command[3] = 0; (*rom)->pwrd->set_pll(command, result); the above code specifies a 12 mhz pll input clock, a system clock of no more than 25 mhz and no locking time-out. set_pll returns pll_cmd_success in result[0] and 24000 in result[1] . the new system clock is 24 mhz. 22.5.1.5 system clock greater than or equal to the expected value command[0] = 12000; command[1] = 25000; command[2] = cpu_freq_gte; command[3] = 0; (*rom)->pwrd->set_pll(command, result); the above code specifies a 12 mhz pll input clock, a system clock of at least 25 mhz and no locking time-out. set_pll returns pll_cmd_success in result[0] and 36000 in result[1] . the new system clock is 36 mhz.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 267 of 313 nxp semiconductors um10601 chapter 22: lpc800 power profile api rom driver 22.5.1.6 system clock approximately equal to the expected value command[0] = 12000; command[1] = 16500; command[2] = cpu_freq_approx; command[3] = 0; (*rom)->pwrd->set_pll(command, result); the above code specifies a 12 mhz pll input clock, a system clock of approximately 16.5 mhz and no locking time-out. set_pll returns pll_cmd_success in result[0] and 16000 in result[1] . the new system clock is 16 mhz. 22.5.2 power control see section 22.5.1.1 and section 22.5.2.2 for examples of the power control api. 22.5.2.1 invalid frequency (device maximum clock rate exceeded) command[0] = 30; command[1] = pwr_cpu_performance; command[2] = 40; (*rom)->pwrd->set_powe r(command, result); the above setup would be used in a system running at the main and system clock of 30 mhz, with a need for maximum cpu proces sing power. since the specified 40 mhz clock is above the 30 mhz maximum, set_power returns pwr_invalid_freq in result[0] without changing anything in the existing power setup. 22.5.2.2 an applicable power setup command[0] = 24; command[1] = pwr_cpu_efficiency; command[2] = 24; (*rom)->pwrd->set_powe r(command, result); the above code specifies that an application is running at the main and system clock of 24 mhz with emphasis on efficiency. set_power returns pwr_cmd_success in result[0] after configuring the microcontroller? s internal power control features.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 268 of 313 23.1 how to read this chapter the i2c-bus rom api is ava ilable on all lpc800 parts. 23.2 features ? simple i2c drivers to send and receive data on the i2c-bus. ? polled and interrupt-driven receive and transmit functions for master and slave modes. 23.3 general description the drivers are callable for use by any application program to send or receive data on the i2c bus. with the i2c drivers it is easy to produce working projects using the i2c interface. the rom routines allow the user to operate t he i2c interface as a master or a slave. the software routines do not implement arbitration to make a master switch to a slave mode in the midst of a transmission. although multi-master arbitration is not implement ed in these i2c drivers, it is possible to use them in a system design with more than one master. if the flag returned from the driver indicates that the message was not successful due to loss of arbitration, the application just resends the message. um10601 chapter 23: lpc800 i2c-bus rom api rev. 1.0 ? 7 november 2012 preliminary user manual
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 269 of 313 nxp semiconductors um10601 chapter 23: lpc800 i2c-bus rom api 23.4 api description the i2c api contains functions to configure th e i2c and send and receive data in master and slave modes. fig 40. i2c-bus driver routines pointer structure
()
(#

)6*+)
(%c"+

()
(#
+*6!+
%c"+



()
(#
+*6!+
%c"+

()
(#
+*6!+
%c"+
, r
()
(#
+*6!+
%c"+
&


$ 6 ' 6 * < # ' ; 6 ' 6 * < # '

$ 6 ' 6 * < # ' ; 6 ' 6 * < # '



')6*+)
)#;(6&+$
9;&!(6#&
(%c"+

)6*+)
%c"+
,2
 p,2,, p,2, p,2, p,2, p,2 p,2, ()
(#
+*6!+
%c"+
/ ()
(#
+*6!+
%c"+
()
(#

')6*+)
)#;(6&+$
6!-6$)-7%&'"+) 6!-<%$(+)-()%&$<6(-5#"" @@@
6!-=+(-$(%(;$ table 250. i2c api calls api call description reference void i2c_isr_handler(i2c_handle_t*) i2c rom driver interrupt service routine. ta b l e 2 5 1 errorcode_t i2c_master_transmit_poll(i2c_handle_t*, i2c_param*, i2c_result* ) i2c master transmit polling ta b l e 2 5 2 errorcode_t i2c_master_receive_poll(i2c_handle_t* , i2c_param* , i2c_result*) i2c master receive polling ta b l e 2 5 3 errorcode_t i2c_master_tx_rx_poll(i2c_handle_t* , i2c_param* , i2c_result*) i2c master transmit and receive polling ta b l e 2 5 4 errorcode_t i2c_master_transmit_intr(i2c_handle_t* , i2c_param* , i2c_result*) i2c master transmit interrupt ta b l e 2 5 5 errorcode_t i2c_master_receive_intr(i2c_handle_t* , i2c_param* , i2c_result*) i2c master receive interrupt ta b l e 2 5 6 errorcode_t i2c_master_tx_rx_intr(i2c_handle_t* , i2c_param* , i2c_result*) i2c master transmit receive interrupt ta b l e 2 5 7
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 270 of 313 nxp semiconductors um10601 chapter 23: lpc800 i2c-bus rom api the following structure has to be defined to use the i2c api: typedef struct i2cd_api { // index of all the i2c driver functions void (*i2c_isr_handler) (i2c_handle_t* h_i2c) ; // isr interrupt service request // master functions *** errorcode_t (*i2c_master_transmit_poll)(i2c_handle_t* h_i2c, i2c_param* ptp, i2c_result* ptr ); errorcode_t (*i2c_master_receive_poll)(i2c_handle_t* h_i2c, i2c_param* ptp, i2c_result* ptr ); errorcode_t (*i2c_master_tx_rx_poll)(i2c_handle_t* h_i2c,i2c_param* ptp, i2c_result* ptr ) ; errorcode_t (*i2c_master_transmit_intr)(i2c_handle_t* h_i2c, i2c_param* ptp, i2c_result* ptr ) ; errorcode_t (*i2c_master_receive_intr)(i2c_handle_t* h_i2c, i2c_param* ptp, i2c_result* ptr ) ; errorcode_t (*i2c_master_tx_rx_intr)(i2c_handle_t* h_i2c, i2c_param* ptp, i2c_result* ptr ) ; // slave functions *** errorcode_t (*i2c_slave_receive_poll)(i2c_handle_t* h_i2c, i2c_param* ptp, i2c_result* ptr ) ; errorcode_t (*i2c_slave_transmit_poll)(i2c_handle_t* h_i2c, i2c_param* ptp, i2c_result* ptr ) ; errorcode_t (*i2c_slave_receive_intr)(i2c_handle_t* h_i2c, i2c_param* ptp, i2c_result* ptr ) ; errorcode_t (*i2c_slave_transmit_intr)(i2c_handle_t* h_i2c, i2c_param* ptp, i2c_result* ptr ) ; errorcode_t (*i2c_set_slave_addr)(i2c_handle_t* h_i2c, uint32_t slave_addr_0_3, uint32_t slave_mask_0_3); // other functions uint32_t (*i2c_get_mem_size)(void) ; //ramsize_in_bytes memory needed by i2c drivers errorcode_t i2c_slave_receive_poll(i2c_handle_t* , i2c_param* , i2c_result*) i2c slave receive polling ta b l e 2 5 8 errorcode_t i2c_slave_transmit_poll(i2c_handle_t* , i2c_param* , i2c_result*) i2c slave transmit polling ta b l e 2 5 9 errorcode_t i2c_slave_receive_intr(i2c_handle_t* , i2c_param* , i2c_result*) i2c slave receive interrupt ta b l e 2 6 0 errorcode_t i2c_slave_transmit_intr(i2c_handle_t* , i2c_param* , i2c_result*) i2c slave transmit interrupt ta b l e 2 6 1 errorcode_t i2c_set_slave_addr(i2c_handle_t*, slave_addr_0_3, slave_mask_0_3) i2c set slave address ta b l e 2 6 2 uint32_t i2c_get_mem_size(void) i2c get memory size ta b l e 2 6 3 i2c_handle_t* i2c_setup(i2c_base_addr, *start_of_ram) i2c setup ta b l e 2 6 4 errorcode_t i2c_set_bitrate(i2c_handle_t*, p_clk_in_hz, bitrate_in_bps) i2c set bit rate ta b l e 2 6 5 uint32_t i2c_get_firmware_version(void ) i2c get firmware version ta b l e 2 6 6 i2c_mode_t i2c_get_status(i2c_handle_t* ) i2c get status ta b l e 2 6 7 errorcode_t i2c_set_timeout(i2c_handle_t* h_i2c, uint32_t timeout) i2c time-out value ta b l e 2 6 8 table 250. i2c api calls api call description reference
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 271 of 313 nxp semiconductors um10601 chapter 23: lpc800 i2c-bus rom api i2c_handle_t* (*i2c_setup)(uint32_t i2c_base_addr, uint32_t *start_of_ram ) ; errorcode_t (*i2c_set_bitrate)(i2c_handle_t* h_i2c, uint32_t p_clk_in_hz, uint32_t bitrate_in_bps) ; uint32_t (*i2c_get_firmware_version)() ; i2c_mode_t (*i2c_get_status)(i2c_handle_t* h_i2c ) ; } i2cd_api_t ; 23.4.1 isr handler 23.4.2 i2c master transmit polling 23.4.3 i2c master receive polling table 251. isr handler routine isr handler prototype void i2c_isr_handler(i2c_handle_t*) input parameter i2c_handle_t - handle to the allocated sram area. return none. description i2c rom driver interrupt service rout ine. this function must be called from the i2c isr when using i2c rom driver interrupt mode. table 252. i2c master transmit polling routine i2c master transmit polling prototype errorcode_t i2c_ master_transmit_poll(i2c_handle_t*, i2c_param*, i2c_result* ) input parameter i2c_handle_t - handle to the allocated sram area. i2c_param - pointer to the i2c param struct. i2c_result - pointer to the i2c result struct. return errorcode. description transmits bytes in the send buffer to a slave. the slave address with the r/w bit =0 is expected in the first byte of th e send buffer. stop condition is sent at end unless stop_flag =0. when the task is completed, the function returns to the line after the call. table 253. i2c master receive polling routine i2c master receive polling prototype errorcode_t i2c_master_receiv e_poll(i2c_handle_t* , i2c_param* , i2c_result*) input parameter i2c_handle_t - handle to the allocated sram area. i2c_param - pointer to the i2c param struct. i2c_result - pointer to the i2c result struct. return errorcode. description receives bytes from slave and put into receive buffer. the slave address with the r/w bit =0 is expected in the first by te of the send buffer. after the task is finished, the slave address with the r/w bit =1 is in the first byte of the receive buffer. stop condition is sent at end unless stop_flag =0. when the task is completed, the function returns to the line after the call.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 272 of 313 nxp semiconductors um10601 chapter 23: lpc800 i2c-bus rom api 23.4.4 i2c master transm it and receive polling 23.4.5 i2c master transmit interrupt 23.4.6 i2c master receive interrupt table 254. i2c master transmit and receive polling routine i2c master transmit and receive polling prototype errorcode_t i2c_master_tx_rx _poll(i2c_handle_t* , i2c_param* , i2c_result*) input parameter i2c_handle_t - handle to the allocated sram area. i2c_param - pointer to the i2c param struct. i2c_result - pointer to the i2c result struct. return errorcode. description first, transmit bytes in the send buffer to a slave and secondly, receives bytes from slave and store it in the receive buffer. the slave address with the r/w bit =0 is expected in the first byte of the send buffer. after the task is finished, the slave address with the r/w bit =1 is in the first byte of the receive buffer. stop condition is sent at end unless stop_flag =0. when the task is completed, the function returns to the line after the call. table 255. i2c master transmit interrupt routine i2c master transmit interrupt prototype errorcode_t i2c_master_transmi t_intr(i2c_handle_t* , i2c_param* , i2c_result*) input parameter i2c_handle_t - handle to the allocated sram area. i2c_param - pointer to the i2c param struct. i2c_result - pointer to the i2c result struct. return errorcode. description transmits bytes in the send buffer to a slave. the slave address with the r/w bit =0 is expected in the first byte of th e send buffer. stop condition is sent at end unless stop_flag =0. program cont rol will be returned immediately and task will be completed on an interrupt-driven basis. when task is completed, the callback function is called. table 256. i2c master receive interrupt routine i2c master receive interrupt prototype errorcode_t i2c_master_receiv e_intr(i2c_handle_t* , i2c_param* , i2c_result*) input parameter i2c_handle_t - handle to the allocated sram area. i2c_param - pointer to the i2c param struct. i2c_result - pointer to the i2c result struct. return errorcode. description receives bytes from slave and put into receive buffer. after the task is finished, the slave address with the r/w bit =1 is in the first byte of the receive buffer. stop condition is sent at end unless stop_flag =0. program control will be returned immediately and task will be completed on an interrupt-driven basis. when task is completed, the callback function is called.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 273 of 313 nxp semiconductors um10601 chapter 23: lpc800 i2c-bus rom api 23.4.7 i2c master transmit receive interrupt 23.4.8 i2c slave receive polling 23.4.9 i2c slave transmit polling table 257. i2c master transmit receive interrupt routine i2c master transmit receive interrupt prototype errorcode_t i2c_master_tx_rx _intr(i2c_handle_t* , i2c_param* , i2c_result*) input parameter i2c_handle_t - handle to the allocated sram area. i2c_param - pointer to the i2c param struct. i2c_result - pointer to the i2c result struct. return errorcode. description first, transmits bytes in the send buffer to a slave and secondly, receives bytes from slave and store it in the re ceive buffer. the slave address with the r/w bit =0 is expected in the first byte of the send buffer. after the task is finished, the slave address with the r/w bit =1 is in the first byte of the receive buffer. stop condition is sent at end unless stop_flag =0. program control will be returned immediately and task will be completed on an interrupt-driven basis. when task is completed, the callback function is called. table 258. i2c slave receive polling routine i2c slave receive polling prototype errorcode_t i2c_slave_receive_poll(i2c_handle_t* , i2c_param* , i2c_result*) input parameter i2c_handle_t - handle to the allocated sram area. i2c_param - pointer to the i2c param struct. i2c_result - pointer to the i2c result struct. return errorcode. description receives data from master. when the task is completed, the function returns to the line after the call. table 259. i2c slave transmit polling routine i2c slave transmit polling prototype errorcode_t i2c_slave_transmi t_poll(i2c_handle_t* , i2c_param* , i2c_result*) input parameter i2c_handle_t - handle to the allocated sram area. i2c_param - pointer to the i2c param struct. i2c_result - pointer to the i2c result struct. return errorcode. description sends data bytes back to master. when the task is completed, the function returns to the line after the call.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 274 of 313 nxp semiconductors um10601 chapter 23: lpc800 i2c-bus rom api 23.4.10 i2c slave receive interrupt 23.4.11 i2c slave transmit interrupt 23.4.12 i2c set slave address 23.4.13 i2c get memory size table 260. i2c slave receive interrupt routine i2c slave receive interrupt prototype errorcode_t i2c_slave_receive_intr(i2c_handle_t* , i2c_param* , i2c_result*) input parameter i2c_handle_t - handle to the allocated sram area. i2c_param - pointer to the i2c param struct. i2c_result - pointer to the i2c result struct. return errorcode. description receives data from master. program control will be returned immediately and task will be completed on an interrupt-driven basis. when task is completed, the callback function is called. table 261. i2c slave transmit interrupt routine i2c slave transmit interrupt prototype errorcode_t i2c_slave_transmit_ intr(i2c_handle_t* , i2c_param* , i2c_result*) input parameter i2c_handle_t - handle to the allocated sram area. i2c_param - pointer to the i2c param struct. i2c_result - pointer to the i2c result struct. return errorcode. description sends data to the master. program control will be returned immediately and task will be completed on an interrupt-driven basis. when task is completed, the callback function is called. table 262. i2c set slave address routine i2c set slave address prototype errorcode_t i2c_set_slave_addr(i2c_handle_t*, slave_addr_0_3, slave_mask_0_3) input parameter i2c_handle_t - handle to the allocated sram area. slave_addr_0_3 - unint32 variable. 7-bit slave address . slave_mask_0_3 - unint32 variable. slave address mask. return errorcode. description sets the slave address and asso ciated mask. the set_slave_addr() function supports four 7-bit slave addresses and masks. table 263. i2c get memory size routine i2c get memory size prototype uint32_t i2c_get_mem_size(void)
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 275 of 313 nxp semiconductors um10601 chapter 23: lpc800 i2c-bus rom api 23.4.14 i2c setup 23.4.15 i2c set bit rate 23.4.16 i2c get firmware version 23.4.17 i2c get status input parameter none. return uint32. description returns the number of bytes in sram needed by the i2c driver. table 263. i2c get memory size routine i2c get memory size table 264. i2c setup routine i2c setup prototype i2c_handle_t* i2c_setu p(i2c_base_addr, *start_of_ram) input parameter i2c_base addr - unint32 variable. base address for i2c peripherals. start_of_ram - unint32 pointer. pointer to allocated sram. return i2c_handle. description returns a handle to the allocated sram area. table 265. i2c set bit rate routine i2c set bit rate prototype errorcode_t i2c_set_bitrate( i2c_handle_t*, p_clk_in_hz, bitrate_in_bps) input parameter i2c_handle_t - handle to the allocated sram area. p_clk_in_hz - unint32 variable. the peripheral clock in hz. bitrate_in_bps - unint32 variable. requested i2c operating frequency in hz. return errorcode. description configures the i2c duty-cycle registers (sclh and scll). table 266. i2c get firmware version routine i2c get firmware version prototype uint32_t i2c_get_ firmware_version(void ) input parameter none. return i2c rom driver version number. description returns the version number. t he firmware version is an unsigned 32-bit number. table 267. i2c get status routine i2c get status prototype i2c_mode_t i2c_get _status(i2c_handle_t* ) input parameter i2c_handle_t - handle to the allocated sram area. return status code. description returns status code. the stat us code indicates the state of the i2c bus. refer to i2c status code table.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 276 of 313 nxp semiconductors um10601 chapter 23: lpc800 i2c-bus rom api 23.4.18 i2c time-out value 23.4.19 error codes 23.4.20 i2c status code 23.4.21 i2c rom driver variables the i2c rom driver requires specific variables to be declared and initialized for proper usage. depending on the operating mode, some variables can be omitted. 23.4.21.1 i2c handle the i2c handle is a pointer allocated for the i2c rom driver. the handle needs to be defined as an i2c handle type: typedef void* i2c_handle_t table 268. i2c time-out value routine i2c time-out value prototype errorcode_t i2c_set_timeout(i2c_handle_t* h_i2c, uint32_t timeout) input parameter i2c_handle_t - handle to the allocated sram area. uint32_t timeout - time value is timeout*16 i2c function clock. if timeout = 0, timeout feature is disabled. return status code. description returns status code. the stat us code indicates the state of the i2c bus. refer to i2c status code table. table 269. error codes error code description comment 0 successful completion functi on was completed successfully. 1 general error - 0x0006 0001 err_i2c_nak - 0x0006 0002 err_i2c_buffer_overflow - 0x0006 0003 err_i2c_byte_count_err - 0x0006 0004 err_i2c_loss_of_arbritration - 0x0006 0005 err_i2c_slave_not_addressed - 0x0006 0006 err_i2c_loss_of_arbritration_nak_bit - 0x0006 0007 err_i2c_general_failure failure detected on i2c bus. 0x0006 0008 err_i2c_regs_set_to_default i2c clock frequency could not be set. default value of 0x04 is loaded into sclh and scll. table 270. i2c status code status code description 0idle 1 master_send 2 master_receive 3 slave_send 4 slave_receive
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 277 of 313 nxp semiconductors um10601 chapter 23: lpc800 i2c-bus rom api after the definition of the handle, the handle must be initialized with i2c base address and ram reserved for the i2c rom driver by making a call to the i2c_setup() function. the callback function type must be defined if in terrupts for the i2c rom driver are used: typedef void (*i2c_callbk_t) (uint32_t err_code, uint32_t n) the callback function will be calle d by the i2c rom driver upon completion of a task when interrupts are used. 23.4.22 param and result structure the i2c rom driver input parameters consist of two structures, a param structure and a result structure. the param structure contains the parameters passed to the i2c rom driver and the result structure contains the results after the i2c rom driver is called. the param structure is as follows: typedef struct i2c_a { //parameters passed to rom function uint32_t num_bytes_send ; uint32_t num_bytes_rec ; uint8_t *buffer_ptr_send ; uint8_t *buffer_ptr_rec ; i2c_callbk_t func_pt; // callback function pointer uint8_t stop_flag; uint8_t dummy[3] ; // required for word alignment } i2c_param ; the result structure is as follows: typedef struct i2c_r { // results struct--results are here when returned uint32_t n_bytes_sent ; uint32_t n_bytes_recd ; } i2c_result ; 23.4.23 error structure the error code returned by the i2c rom driver is an enum structure. the error structure is as follows: typedef enum { lpc_ok=0, /**< enum value returned on success */ error, err_i2c_base = 0x00060000, /*0x00060001*/ err_i2c_nak=err_i2c_base+1, /*0x00060002*/ err_i2c_buffer_overflow, /*0x00060003*/ err_i2c_byte_count_err, /*0x00060004*/ err_i2c_loss_of_arbritration, /*0x00060005*/ err_i2c_slave_not_addressed, /*0x00060006*/ err_i2c_loss_of_arbritration_nak_bit, /*0x00060007*/ err_i2c_general_failure, /*0x00060008*/ err_i2c_regs_set_to_default
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 278 of 313 nxp semiconductors um10601 chapter 23: lpc800 i2c-bus rom api } errorcode_t; 23.4.24 i2c mode the i2c_get_status() function returns the curr ent status of the i2c engine. the return codes can be defined as an enum structure: typedef enum i2c_mode { idle, master_send, master_receive, slave_send, slave_receive } i2c_mode_t ; 23.4.25 i2c rom driver pointer the i2c rom driver resides in the address 0x1fff1ff8. the address must be declared to allow access to the rom driver: #define rom_drivers_ptr ((rom *)(*((unsigned int *)0x1fff1ff8))) 23.5 functional description 23.5.1 i2c set-up before calling any setup functions in the i2c rom, the application pr ogram is responsible for doing the following: 1. enable the clock to the i2c peripheral. 2. enable the two pins required for the scl and sda outputs of the i2c peripheral. 3. allocate a ram area for dedicated use of the i2c rom driver. after the i2c block is configured, the i2c rom driver variables have to be set up: 1. initialize pointer to th e i2c api function table. 2. declare the param and result struct. 3. declare error code struct. 4. declare the transmit and receive buffer. if interrupts are used, then additional driver variables have to be set up: 1. declare the i2c_callbk_ t type. 2. declare callback functions. 3. declare i2c rom driver isr within the i2c isr. 4. enable i2 c interrupt. 23.5.2 i2c master mode set-up the i2c rom driver support pollin g and interrupts. in the master mode , 7-bit and 10-bit addressing are supported. the setup is as follows:
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 279 of 313 nxp semiconductors um10601 chapter 23: lpc800 i2c-bus rom api 1. allocate sram for the i2c rom driver by making a call to th e i2c_get_mem_size() function. 2. create the i2c handle by making a call to the i2c_ setup() function. 3. set the i2c operating frequency by making a call to the i2c_set_bitrate() function. pi2capi = rom_drivers_ptr->pi2cd; //setup i2c function table pointer size_in_bytes = pi2capi->i2c_get_mem_size(); i2c_handle = pi2capi->i2c_setup(lpc_i2c_base, (uint32_t *)&i2c_handle[0] ); error_code = pi2capi->i2c_set_bitrate((i2c_handle_t*)i2c_handle, pclk_in_hz, bps_in_hz); 23.5.3 i2c slave mode set-up the i2c rom driver support po lling and interrupts in the slav e mode. in the slave mode, only 7-bit addressing is supported. the set-up is as follows: 1. allocate sram for the i2c rom driver by making a call to th e i2c_get_mem_size() function. 2. create the i2c handle by making a call to the i2c_ setup() function. 3. set the i2c operating frequency by making a call to the i2c_set_bitrate() function. 4. set the slave address by making a ca ll to the i2c_set_slave_addr() function. the i2c rom driver allows setting up to 4 slave addresses and 4 address masks as well as possibly enabling the general call address. the four slave address bytes are packed into the 4 byte variable. slave address byte 0 is the least significant byte and slave address by te 3 is the most significant byte. the slave address mask bytes are ordered the same way in the other 32 bit variable. when in slave receive mode, all of these addresses (or grou ps if masks are used) will be monitored for a match. if the general call bit (least significant bit of any of the four slave address bytes) is set, then the general call address of 0x00 is monitored as well. pi2capi = rom_drivers_ptr->pi2cd; //setup i2c function table pointer size_in_bytes = pi2capi->i2c_get_mem_size(); i2c_handle = pi2capi->i2c_setup(lpc_i2c_base, (uint32_t *)&i2c_handle[0] ); error_code = pi2capi->i2c_set_bitrate((i2c_handle_t*)i2c_handle, pclk_in_hz, bps_in_hz); error_code = pi2capi->i2c_set_slave_addr((i2c_handle_t*)i2c_handle, slave_addr, slave_addr_mask) ; fig 41. i2c slave mode set-up address packing          
                  
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 280 of 313 nxp semiconductors um10601 chapter 23: lpc800 i2c-bus rom api 23.5.4 i2c master transmit/receive the master mode drivers give the user the choi ce of either polled (wait for the message to finish) or interrupt driven routines (non-blocking). polled routines are recommended for testing purposes or very simple i2c applicati ons. these routines allow the master to send to slaves with 7-bit or 10-bit addresses. the following routines are polled routines : err_code i2c_master_transmit_poll(i2c_handle_t*, i2c_param*, i2c_result*) err_code i2c_master_receive_poll(i2c_handle_t*, i2c_param*, i2c_result*) err_code i2c_master_tx_rx_poll (i2c_handle_t*, i2c_param*, i2c_result*) the following routines are interrupt driven routines: err_code i2c_master_transmit_intr(i2c_handle_t*, i2c_param*, i2c_result*) err_code i2c_master_receive_intr(i2c_handle_t*, i2c_param*, i2c_result*) err_code i2c_master_tx_rx_intr(i2c_handle_t*, i2c_param*, i2c_result*) where: ? err_code is the return state of the function. an ?0? indicates success. all non-zero indicates an error. refer to error table. ? i2c_parm* is a stru cture with parameters passed to the function. refer to section 23.4.22 . ? i2c_result* is a containing the re sults after the function executes. to initiate a master mode wr ite/read the i2c_param has to be setup. the i2c_param is a structure with various variables needed by th e i2c rom driver to ope rate correctly. the structure contains the following: ? number of bytes to be transmitted. ? number of bytes to be receive. ? pointer to the transmit buffer. ? pointer to the receive buffer. ? pointer to callback function. ? stop flag. the result structure contains the results after the function executes. the structure contains the following: ? number of bytes transmitted. ? number of bytes received. remark: the number of bytes trans mitted will be updated for i2c_master_t ransmit_intr() and i2c_master_t ransmit_poll(). the number of by tes received will onl y be update on i2c_master_receive_poll(), i2c_master_recei ve_intr(), i2c_master_tx_rx_poll(), and i2c_master_tx_rx_intr().
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 281 of 313 nxp semiconductors um10601 chapter 23: lpc800 i2c-bus rom api in all the master mode routines , the transmit buffer?s first byte must be the slave address with the r/w bit set to ?0?. to enable a master read, the receive buffer?s first byte must be the slave address with the r/w bit set to ?1?. the following conditions must be fulfilled to use the i2c driver routines in master mode: ? for 7-bit addressing, the first byte of the send buffer must have the slave address in the most significant 7 bits and the least significant (r/w) bit = 0. example: slave address 0x53, first byte is 0xa6. ? for 7-bit addressing, the first byte of the re ceive buffer must have the slave address in the most significant 7 bits and the least sign ificant (r/w) bit = 1. example: slave addr 0x53, first byte 0xa7. ? for 10-bit address, the first byte of the tr ansmit buffer must have the slave address most significant 2 bits with the (r/w) bi t =0. the second byte must contain the remaining 8-bit of the slave address. ? for 10-bit address, the first byte of the receive buffer must have the slave address most significant 2 bits with the (r/w) bi t =1. the second byte must contain the remaining 8-bit of the slave address. ? the number of bytes to be transmitted should include the first byte of the buffer which is the slave address byte. example: 2 data bytes + 7-bit slave addr = 3. ? the application program must enable i2c interrupts. when i2c interrupt occurs, the i2c_isr_handler function must be called from the application program. when using the interrupt function calls, the callback functions must be define. upon the completion of a read/write as specified by the param structure, the callback functions will be invoked. 23.5.5 i2c slave mode transmit/receive in slave mode, polled routines are intended for testing purposes. it is up to the user to decide whether to use the polled or interrupt driven mode. while operating the slave driver in polled mode can be useful for program development and debugging, most applications will need the interrupt-driven versions of slav e receive and transmit in the final software. the following routines are polled routines: err_code i2c_slave_receive_poll(i2c_handle_t*, i2c_param*, i2c_result*) err_code i2c_slave_transmit_poll(i2c_handle_t*, i2c_param*, i2c_result*) the following routines are interrupt driven routines: err_code i2c_slave_receive_intr(i2c_handle_t*, i2c_param*, i2c_result*) err_code i2c_slave_transmit_intr(i2c_handle_t*, i2c_param*, i2c_result*) where: ? err_code is the return state of the function. an 0 indicates success. all non-zero indicates an error. refer to the error code table. ? i2c_parm is a structure with para meters passed to the function. section 23.4.22 .
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 282 of 313 nxp semiconductors um10601 chapter 23: lpc800 i2c-bus rom api ? i2c_result is a containing the results after the function executes. section 23.4.22 . to initiate a master-mode write/read the i2c_param has to be setup. the i2c_param is a structure with various variables needed by th e i2c rom driver to ope rate correctly. the structure contains the following: ? number of bytes to be transmitted. ? number of bytes to be received. ? pointer to the transmit buffer. ? pointer to the receive buffer. ? pointer to callback function. ? stop flag. the result structure contains the results after the function executes. the structure contains the following: ? number of bytes transmitted. ? number of bytes received. remark: the number of bytes transmitted is upd ated only for i2c_slave_send_poll() and i2c_slave_send_intr(). the number of bytes received is updated only for i2c_slave_receive_poll() and i2c_slave_receive_intr(). to initiate a slave mode communication, the re ceive function is called. this can be either the polling or interrupt driven func tion, i2c_slave_receive_poll() or i2c_slave_receive_in tr(), respectively. the receive buffer should be as large or larger than any data or command that will be received. if the amount of da ta exceed the receive buffer size, an error code will be returned. in slave-receive mode, the driver receives data until one of the following are true: ? address matching set in the set_slave_addr() function with the r/w bit set to 1 ? stop or repeated start is received ? an error condition is detected when using the interrupt function calls, the callback functions must be define. upon the completion of a read/write as specified by the param structure, the callback functions will be invoked. 23.5.6 i2c time-out feature //timeout: timeout time value. specifies the timeout interval value in increments of // 16 i2c function clocks (min value is 16). // if timeout = 0, timeout feature is disabled // if timeout != 0, time value is timeout*16 i2c function clock. errorcode_t i2c_set_timeout(i2c_handle_t* h_i2c, uint32_t timeout) { i2c_driver_typedef *h ; // declare pointer to i2c structure [handle] h = (i2c_driver_typedef*) h_i2c ; //assign handle pointer address if (timeout != 0){ h->i2c_base->timeout = (timeout - 1)<<4;
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 283 of 313 nxp semiconductors um10601 chapter 23: lpc800 i2c-bus rom api // enable timeout feature h->i2c_base->cfg |= bi2c_timeout_en; } else // disable timeout feature h->i2c_base->cfg &= ~bi2c_timeout_en; return(lpc_ok) ; }//i2c_set_timeout
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 284 of 313 24.1 how to read this chapter the usart rom driver routines are available on all lpc800 parts. 24.2 features ? send and receive characters in asynchronus uart mode ? send and receive multiple characters (line) in asynchronous uart mode 24.3 general description the uart api handles sending and receiving characters using any of the usart blocks in asynchronous mode. remark: because all usarts share a common fracti onal divider, the uart_init routine returns the value for the common divider. um10601 chapter 24: lpc800 usart api rom driver routines rev. 1.0 ? 7 november 2012 preliminary user manual fig 42. usart driver routines pointer structure
()
(#

)6*+)
(%c"+

()
(#
+*6!+
%c"+



()
(#
+*6!+
%c"+

()
(#
+*6!+
%c"+
, r
()
(#
+*6!+
%c"+
&


$ 6 ' 6 * < # ' ; 6 ' 6 * < # '




')6*+)
)#;(6&+$
9;&!(6#&
(%c"+

)6*+)
%c"+
,2
 p,2,, p,2, p,2, p,2, p,2 p,2 p,2, ()
(#
+*6!+
%c"+
/ ()
(#
+*6!+
%c"+
()
(#

')6*+)
)#;(6&+$
;%)(-=+(-<+<-$6t+ ;%)(-$+(;5 @@@
;%)(-6$) @@@
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 285 of 313 nxp semiconductors um10601 chapter 24: lpc800 usart api rom driver routines 24.4 api description the uart api contains functions to send a nd receive characters via any of the usart blocks. the following structure has to be defined to use the uart api: typedef struct uartd_api { // index of all the uart driver functions uint32_t (*uart_get_mem_size)(void); uart_handle_t (*uart_setup)(uint32_t base_addr, uint8_t *ram); uint32_t (*uart_init)(uart_handle_t handle, uart_config_t *set); //--polling functions--// uint8_t (*uart_get_char)(uart_handle_t handle); void (*uart_put_char)(uart_handle_t handle, uint8_t data); uint32_t (*uart_get_line)(uart_handle_t handle, uart_param_t * param); uint32_t (*uart_put_line)(uart_handle_t handle, uart_param_t * param); //--interrupt functions--// void (*uart_isr)(uart_handle_t handle); } uartd_api_t ; // end of structure 24.4.1 uart get memory size table 271. uart api calls api call description reference uint32_t ramsize_in_bytes uart_get_mem_size( void) ; uart get memory size ta b l e 2 7 2 uart_handle_t* uart_setup(uint32_t base_addr, uint8_t *ram) ; uart set-up ta b l e 2 7 3 uint32_t uart_init(uart_handle_t* handle, uart_config set); uart init ta b l e 2 7 4 uint8_t uart_get_char(uart_handle _t* handle); uart get character ta b l e 2 7 5 void uart_put_char(uart_handle_t* handle, uint8_t data); uart put character ta b l e 2 7 6 uint32_t uart_get_line(uart_ha ndle_t* handle, uart_param_t param); uart get line ta b l e 2 7 7 uint32_t uart_put_line(uart_handle_t* handle, uart_param_t param); uart put line ta b l e 2 7 8 void uart_isr(uart_handle_t* handle); uart interrupt service routine ta b l e 2 7 9 table 272. uart_get_mem_size routine uart_get_mem_size prototype uint32_t ramsize_in_byte s uart_get_mem_size( void) ; input parameter none. return memory size in bytes. description get the memory size needed by one min uart instance.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 286 of 313 nxp semiconductors um10601 chapter 24: lpc800 usart api rom driver routines 24.4.2 uart setup 24.4.3 uart init 24.4.4 uart get character 24.4.5 uart put character table 273. uart_setup routine uart_setup prototype uart_handle_t* uart_setup(uint 32_t base_addr, uint8_t *ram) ; input parameter base_addr: base address of register for this uart block. ram: pointer to the memo ry space for uart instance. the size of the memory space can be obtained by the uart_get_mem_size function. return the handle to corresponding uart instance. description setup min uart instance with provided memory and return the handle to this instance. table 274. uart_init routine uart_init prototype uint32_t uart_init(uart_handle_t* handle, uart_config set); input parameter handle: the handle to the uart instance. set: configuration for uart operation. return fractional divider value if system cl ock is not integer multiples of baud rate. description setup baud rate and operation mode for uart, then enable uart. table 275. uart_get_char routine uart_get_char prototype uint8_t uart_get_c har(uart_handle_t* handle); input parameter handle: the handle to the uart instance. return received data description receive one char from uart. this functions is only returned after char is received. in case echo is enabled, the received data is sent out immediately. table 276. uart_put_char routine uart_put_char prototype void uart_put_char(uart_handle_t* handle, uint8_t data); input parameter handle: the handle to the uart instance. data: data to be sent out. return none. description send one char through uart. this function is only returned after data is sent.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 287 of 313 nxp semiconductors um10601 chapter 24: lpc800 usart api rom driver routines 24.4.6 uart get line 24.4.7 uart put line 24.4.8 uart interrupt service routine 24.4.9 error codes table 277. uart_get_line routine uart_get_line prototype uint32_t uart_get_line(ua rt_handle_t* handle, uart_param_t param); input parameter handle: the handle to the uart instance. param: refer to ua rt_param_t definition. return error code: err_uart_receive_on - uart receive is ongoing. description receive multiple bytes from uart. table 278. uart_put_line routine uart_put_line prototype uint32_t uart_ put_line(uart_handle_t* handle, uart_param_t param); input parameter handle: the handle to the uart instance. param: refer to ua rt_param_t definition. return error code: err_uart_send_on - uart sending is ongoing. description send string (end with \0) or raw data through uart. table 279. uart_isr routine uart_isr prototype void uart_isr(uart_handle_t* handle); input parameter handle: the handle to the uart instance. return none. description uart interrupt service routine. to use this routine, the corresponding usart interrupt must be enabled. this fu nction is invoked by the user isr. table 280. error codes return code error code description 0x0008 0001 err_uart_rxd_busy = err_uart_base+1, uart receive is busy 0x0008 0002 err_uart_txd_busy uart transmit is busy 0x0008 0003 err_uart_overrun_fra me_parity_noise overrun error, frame error, parity error, rxnoise error 0x0008 0004 err_uart_underrun underrun error 0x0008 0005 err_uart_param parameter error
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 288 of 313 nxp semiconductors um10601 chapter 24: lpc800 usart api rom driver routines 24.4.10 uart rom driver variables 24.4.10.1 uart_config structure typdef struct uart_config { uint32_t sys_clk_in_hz; // sytem clock in hz. uint32_t baudrate_in_hz; // baudrate in hz uint8_t config; //bit1:0 // 00: 7 bits length, 01: 8 bits lenght, others: reserved //bit3:2 // 00: no parity, 01: reserved, 10: even, 11: odd //bit4 // 0: 1 stop bit, 1: 2 stop bits uint8_t sync_mod; //bit0: 0(async mode), 1(sync mode) //bit1: 0(un_rxd is sampled on the falling edge of sclk) // 1(un_rxd is sampled on the rising edge of sclk) //bit2: 0(start and stop bits are transmitted as in asynchronous //mode) // 1(start and stop bits are not transmitted) //bit3: 0(the uart is a slave on sync mode) // 1(the uart is a master on sync mode) uint16_t error_en; //bit0: overrunen, bit1: underrunen, bit2: frameerren, // bit3: parityerren, bit4: rxnoiseen } 24.4.10.2 uart_handle_t the handle to the instance of the uart driver. each uart has one handle, so there can be several handles for up to three uart blo cks. this handle is created by init api and used by the transfer functions for the corresponding uart block. typedef void uart_handle_t ; // define type for uart handle pointer 24.4.10.3 uart_param_t typedef struct uart_a { // parms passed to uart driver function uint8_t * buffer ; // the pointer of buffer. // for uart_get_line function, buffer for receiving data. // for uart_put_line function, buffer for transmitting data. uint32_t size; // [in] the size of buffer. //[out] the number of bytes transmitted/received. uint16_t transfer_mode ; // 0x00: for uart_get_line function, transfer without // termination. // for uart_put_line function, transfer without termination. // 0x01: for uart_get_line function, stop transfer when // are received. // for uart_put_line function, transfer is stopped after // reaching \0. characters are sent out after that. // 0x02: for uart_get_line function, stop transfer when // is received. // for uart_put_line function, transfer is stopped after // reaching \0. a character is sent out after that. //0x03: for uart_get_line function, reserved.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 289 of 313 nxp semiconductors um10601 chapter 24: lpc800 usart api rom driver routines // for uart_put_line function, transfer is stopped after // reaching \0. uint16_t driver_mode; //0x00: polling mode, function is blocked until transfer is // finished. // 0x01: intr mode, function exit immediately, callback function // is invoked when transfer is finished. //0x02: reserved uart_callbk_t callback_func_pt; // callback function } uart_param_t ; 24.5 functional description
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 290 of 313 25.1 how to read this chapter the debug functionality is iden tical for all lpc800 parts. 25.2 features ? supports arm serial wire debug mode. ? direct debug access to all memories, registers, and peripherals. ? no target resources are required for the debugging session. ? four breakpoints. ? two data watchpoints that can also be used as triggers. ? supports jtag boundary scan. ? micro trace buffer (mtb) supported. 25.3 general description debug functions are integrated into the arm cortex-m0+. serial wire debug functions are supported. the arm cortex-m0+ is configured to support up to four breakpoints and two watchpoints. support for boundary scan and micro trace buffer is available. 25.4 pin description the swd functions are assigned to pins thro ugh the switch matrix. the swd functions are fixed-pin functions that are enabled th rough the switch matrix and can only be assigned to special pins on the package. the swd functions are enabled by default. see section 9.3.2 to enable the analog comparator inputs and the reference voltage input. the boundary scan mode and the pins needed are selected by hardware (see section 25.5.3 ). there is no access to the boundary scan pins through the switch matrix. um10601 chapter 25: lpc800 debugging rev. 1.0 ? 7 november 2012 preliminary user manual table 281. swd pin description function type pin description swm register reference swclk i/o swclk/pio0_3/ tclk serial wire clock. this pin is the clock for swd debug logic when in the serial wire debug mode (swd). this pin is pulled up internally. pinenable0 table 105 swdio i/o swdio/pio0_2/ tms serial wire debug data input/output. the swdio pin is used by an external debug tool to communicate with and control the lpc800. this pin is pulled up internally. pinenable0 table 105
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 291 of 313 nxp semiconductors um10601 chapter 25: lpc800 debugging 25.5 functional description 25.5.1 debug limitations it is recommended not to use the debug mode during deep-sleep or power-down mode mode. during a debugging session, the system tick timer is automatically stopped whenever the cpu is stopped. other peripherals are not affected. 25.5.2 debug connections for swd for debugging purposes, it is useful to prov ide access to the isp entry pin pio0_1. this pin can be used to recover the part from conf igurations which would disable the swd port such as improper pll configuration, reconfiguration of swd pins, entry into deep power-down mode out of reset, etc. this pi n can be used for other functions such as gpio, but it should not be held low on power-up or reset. table 282. jtag boundary scan pin description function pin name type description tck swclk/pio0_3/ tck i jtag test clock. this pin is the clock for jtag boundary scan when the reset pin is low. tms swdio/pio0_2/ tms i jtag test mode select. the tms pin selects the next state in the tap state machine. this pin includes an internal pull-up and is used for jtag boundary scan when the reset pin is low. tdi pio0_1/acmp_i2/ clkin/tdi i jtag test data in. this is the serial data input for the shift register. this pin includes an internal pull-up and is used for jtag boundary scan when the reset pin is low. tdo pio0_0/acmp_i1/ tdo o jtag test data output. this is the serial data output from the shift register. data is shifted out of the device on the negativ e edge of the tck signal. this pin is used for jtag boundary sc an when the reset pin is low. trst pio0_4/ wakeup/trst i jtag test reset. the trst pin can be used to reset the test logic within the debug logic. this pin includes an internal pull-up and is used for jtag boundary scan when the reset pin is low.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 292 of 313 nxp semiconductors um10601 chapter 25: lpc800 debugging 25.5.3 boundary scan the reset pin selects between the jtag boundary scan (reset = low) and the arm swd debug (reset = high). the arm swd debug port is disabled while the lpc11uxx is in reset. to perform boundary scan testing, follow these steps: 1. erase any user code residing in flash. 2. power up the part with the reset pin pulled high externally. 3. wait for at least 250 ? s. 4. pull the reset pin low externally. 5. perform boundary scan operations. 6. once the boundary scan operations are completed, assert the trst pin to enable the swd debug mode and release the reset pin (pull high). remark: the jtag interface cannot be used for debug purposes. remark: por, bod reset, or a low on the trst pin puts the test tap controller in the test-logic reset state. the first tck clock while reset = high places the test tap in run-test idle mode. the vtref pin on the swd connector enables the debug connector to match the target voltage. fig 43. connecting the swd pins to a standard swd connector  6=&%"$
9)#<

!#&&+!(#)   4 &' 4    &   
+&()d ,-
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 293 of 313 26.1 packages um10601 chapter 26: lpc800 packa ges and pin description rev. 1.0 ? 7 november 2012 preliminary user manual fig 44. pin configuration dip8 package (lpc810m021fn8)  ,-8 ,-,-  ,-   4  ,-/  4  ,-  ,--     /  8  >  fig 45. pin configuration tssop16 package   !"   !" " ,-/ ,-,-  ,- ,-4  ,-8 ,-> ,-   4  ,-/  4  ,-  ,-3  ,- ,-?3  ,-, ,--      / 8  >  , ?    /  8 fig 46. pin configuration so20 package (lpc812m101fd20)  ,-> ,- ,-/ ,-,-  ,- ,-4  ,-8 ,-> ,-   4  ,-/  4  ,-  ,-3  ,- ,-?3  ,-, ,--  ,- ,-8     / 8  >  ? ,    /  8  > , ?
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 294 of 313 nxp semiconductors um10601 chapter 26: lpc800 packages and pin description 26.2 pin description the pin description table ta b l e 2 8 3 shows the pin functions that are fixed to specific pins on each package. these fixed-pin functi ons are selectable between the gpio, comparator, swd, and the xtal pins. by defaul t, the gpio function is selected except on pins pio0_2, pio0_3, and pio0_5. jtag functions are available in boundary scan mode only. movable function for the i2c, usart, spi, and sct pin functions can be assigned through the switch matrix to any pin that is not power or ground in place of the pin?s fixed functions. the following exceptions apply: for full i2c-bus compatibility, as sign the i2c function s to the open-drain pins pio0_11 and pio0_10. do not assign more than one output to any pin. however, more than one input can be assigned to a pin. pin pio0_4 triggers a wake-up from deep pow er-down mode. if you need to wake up from deep power-down mode via an external pin, do not assign any movable function to this pin. the jtag functions tdo, tdi, tck, tms, and trst are selected on pins pio0_0 to pio0_4 by hardware when the part is in boundary scan mode. fig 47. pin configuration tssop20 package   !  ,-> ,- ,-/ ,-,-  ,- ,-4  ,-8 ,-> ,-   4  ,-/  4  ,-  ,-3  ,- ,-?3  ,-, ,--  ,- ,-8     / 8  >  ? ,    /  8  > , ?
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 295 of 313 nxp semiconductors um10601 chapter 26: lpc800 packages and pin description table 283. pin description table (fixed pins) symbol so20/ tssop20 tssop16 dip8 type reset state [1] description pio0_0/acmp_i1/ tdo 19 16 8 [5] i/o i; pu pio0_0 ? general purpose digital in put/output port 0 pin 0. in isp mode, this is the usart0 receive pin u0_rxd. in boundary scan mode: tdo (test data out). ai - acmp_i1 ? analog comparator input 1. pio0_1/acmp_i2/ clkin/tdi 12 9 5 [5] i/o i; pu pio0_1 ? general purpose digital in put/output pin. isp entry pin. a low level on this pin during reset starts the isp command handler. in boundary scan mode: tdi (test data in). ai - acmp_i2 ? analog comparator input 2. i- clkin ? external clock input. swdio/pio0_2/tms 7 6 4 [2] i/o i; pu swdio ? serial wire debug i/o. swdio is enabled by default on this pin. in boundary scan mode: tms (test mode select). i/o - pio0_2 ? general purpose digital input/output pin. swclk/pio0_3/ tck 653 [2] i/o i; pu swclk ? serial wire clock. swclk is enabled by default on this pin. in boundary scan mode: tck (test clock). i/o - pio0_3 ? general purpose digital input/output pin. pio0_4/wakeup/ trst 542 [6] i/o i; pu pio0_4 ? general purpose digita l input/output pin. in isp mode, this is the usart0 transmit pin u0_txd. in boundary scan mode: trst (test reset). this pin triggers a wake-up from deep power-down mode. if you need to wake up from deep power-down mode via an external pin, do not assign any movable function to this pin. pull this pin high externally to enter deep power-down mode. pull this pin low to exit deep power-down mode. a low-going pulse as short as 50 ns wakes up the part. reset /pio0_5 4 3 1 [4] i/o i; pu reset ? external reset input: a low-going pulse as short as 50 ns on this pin resets the device, causing i/o ports and peripherals to take on their def ault states, and processor execution to begin at address 0. i- pio0_5 ? general purpose digita l input/output pin. pio0_6/vddcmp 18 15 - [9] i/o i; pu pio0_6 ? general purpose digital input/output pin. ai - vddcmp ? alternate reference voltage for the analog comparator. pio0_7 17 14 - [2] i/o i; pu pio0_7 ? general purpose digital input/output pin. pio0_8/xtalin 14 11 - [8] i/o i; pu pio0_8 ? general purpose digital input/output pin. i- xtalin ? input to the oscillator circuit and internal clock generator circuits. input vo ltage must not exceed 1.95 v. pio0_9/xtalout 13 10 - [8] i/o i; pu pio0_9 ? general purpose digital input/output pin. o- xtalout ? output from the oscillator circuit. pio0_10 9 8 - [3] iia pio0_10 ? general purpose digital input/output pin. assign i2c functions to this pin when true open-drain pins are needed for a signal compliant with the full i2c specification.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 296 of 313 nxp semiconductors um10601 chapter 26: lpc800 packages and pin description [1] pin state at reset for default function: i = input; ai = anal og input; o = output; pu = internal pull-up enabled (pins pulle d up to full v dd level ); ia = inactive, no pull-up/down enabled. [2] 5 v tolerant pad providing digital i/o functions with conf igurable pull-up/pull-down resistor s and configurable hysteresis; includes high-current output driver. [3] true open-drain pin. i 2 c-bus pins compliant with the i 2 c-bus specification for i 2 c standard mode, i 2 c fast-mode, and i 2 c fast-mode plus. do not use this pad for high-s peed applications like the spi clock. [4] reset functionality is not available in deep power-down mode. us e the wakeup pin to reset the chip and wake up from deep power-down mode. an external pull-up resistor is required on this pin for the deep power-down mode. [5] 5 v tolerant pin providing standard digita l i/o functions with configurable modes, configurable hysteresis, and analog input . when configured as an analog input, the digital section of t he pin is disabled, and the pin is not 5 v tolerant. [6] 5 v tolerant pad providing digital i/o functions with conf igurable pull-up/pull-down resistor s and configurable hysteresis. in deep power-down mode, pulling this pin low wakes up the chip. [7] 5 v tolerant pad providing digital i/o functions with conf igurable pull-up/pull-down resistor s and configurable hysteresis. [8] 5 v tolerant pin providing standard digital i/o functions wi th configurable modes, configur able hysteresis, and analog i/o f or the system oscillator. when configured as an analog i/o, the digital section of the pin is disabled, and the pin is not 5 v tolerant. [9] not a 5 v tolerant pin due to special analog functionality. pi n provides standard digital i/o functions with configurable mo des, configurable hysteresis, and anal og i/o. when configured as an analog i/o, t he digital section of the pin is disabled pio0_11 8 7 - [3] iia pio0_11 ? general purpose digital in put/output pin. assign i2c functions to this pin when true open-drain pins are needed for a signal compliant with the full i2c specification. pio0_12 3 2 - [2] i/o i; pu pio0_12 ? general purpose digital input/output pin. pio0_13 2 1 - [2] i/o i; pu pio0_13 ? general purpose digital input/output pin. pio0_14 20 - - [7] i/o i; pu pio0_14 ? general purpose digital input/output pin. pio0_15 11 - - [7] i/o i; pu pio0_15 ? general purpose digital input/output pin. pio0_16 10 - - [7] i/o i; pu pio0_16 ? general purpose digital input/output pin. pio0_17 1 - - [7] i/o i; pu pio0_17 ? general purpose digital input/output pin. v dd 15 12 6 - - 3.3 v supply voltage. v ss 16 13 7 - ground. table 283. pin description table (fixed pins) symbol so20/ tssop20 tssop16 dip8 type reset state [1] description table 284. movable functions (assign to pins pio0_0 to pio_17 through switch matrix) function name type description u0_txd o transmitter output for usart0. u0_rxd i receiver input for usart0. u0_rts o request to send output for usart0. u0_cts i clear to send input for usart0. u0_sclk i/o serial clock input/output for usart0 in synchronous mode. u1_txd o transmitter output for usart1. u1_rxd i receiver input for usart1. u1_rts o request to send output for usart1. u1_cts i clear to send input for usart1. u1_sclk i/o serial clock input/output for usart1 in synchronous mode. u2_txd o transmitter output for usart2.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 297 of 313 nxp semiconductors um10601 chapter 26: lpc800 packages and pin description u2_rxd i receiver input for usart2. u2_rts o request to send output for usart2. u2_cts i clear to send input for usart2. u2_sclk i/o serial clock input/output for usart2 in synchronous mode. spi0_sck i/o serial clock for spi0. spi0_mosi i/o master out slave in for spi0. spi0_miso i/o master in slave out for spi0. spi0_ssel i/o slave select for spi0. spi1_sck i/o serial clock for spi1. spi1_mosi i/o master out slave in for spi1. spi1_miso i/o master in slave out for spi1. spi1_ssel i/o slave select for spi1. ctin_0 i sct input 0. ctin_1 i sct input 1. ctin_2 i sct input 2. ctin_3 i sct input 3. ctout_0 o sct output 0. ctout_1 o sct output 1. ctout_2 o sct output 2. ctout_3 o sct output 3. i2c0_scl i/o i 2 c-bus clock input/output (open-drain if assigned to pin pio0_10). high-current sink only if a ssigned to pio0_10 and if i 2 c fast-mode plus is selected in the i/o configuration register. i2c0_sda i/o i 2 c-bus data input/output (open-drai n if assigned to pin pio0_11). high-current sink only if assigned to pin pio0_11 and if i 2 c fast-mode plus is selected in the i/o configuration register. acmp_o o analog comparator output. clkout o clock output. gpio_int_bmat o output of the pattern match engine. table 284. movable functions (assign to pins pio0_0 to pio_17 through switch matrix) function name type description
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 298 of 313 27.1 abbreviations 27.2 references [1] ddi0484b_cortex_m0p_r0p0_trm ? arm cortex-m0+ technical reference manual um10601 chapter 27: supplementary information rev. 1.0 ? 7 november 2012 preliminary user manual table 285. abbreviations acronym description ahb advanced high-performance bus apb advanced peripheral bus bod brownout detection gpio general-purpose input/output pll phase-locked loop rc resistor-capacitor spi serial peripheral interface smbus system management bus tem transverse electromagnetic uart universal asynchronous receiver/transmitter
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 299 of 313 nxp semiconductors um10601 chapter 27: supplementary information 27.3 legal information 27.3.1 definitions draft ? the document is a draft versi on only. the content is still under internal review and subject to formal approval, which may result in modifications or additions. nxp semiconductors does not give any representations or warranties as to the accuracy or completeness of information included herein and shall hav e no liability for the consequences of use of such information. 27.3.2 disclaimers limited warranty and liability ? information in this document is believed to be accurate and reliable. however, nxp semiconductors does not give any representations or warranties, expressed or implied, as to the accuracy or completeness of such information and shall have no liability for the consequences of use of such info rmation. nxp semiconductors takes no responsibility for the content in this document if provided by an information source outside of nxp semiconductors. in no event shall nxp semiconductors be liable for any indirect, incidental, punitive, special or consequential damages (including - without limitation - lost profits, lost savings, business interrupt ion, costs related to the removal or replacement of any products or rework charges) whether or not such damages are based on tort (including negligence), warranty, breach of contract or any other legal theory. notwithstanding any damages that customer might incur for any reason whatsoever, nxp semiconductors? aggregate and cumulative liability towards customer for the products described herein shall be limited in accordance with the terms and conditions of commercial sale of nxp semiconductors. right to make changes ? nxp semiconductors reserves the right to make changes to information published in this document, including without limitation specifications and product descriptions, at any time and without notice. this document supersedes and replaces all information supplied prior to the publication hereof. suitability for use ? nxp semiconductors products are not designed, authorized or warranted to be suitable for use in life support, life-critical or safety-critical systems or equipment, nor in applications where failure or malfunction of an nxp semiconductors product can reasonably be expected to result in personal injury, death or severe property or environmental damage. nxp semiconductors and its suppliers accept no liability for inclusion and/or use of nxp semiconducto rs products in such equipment or applications and therefore such inclusion and/or use is at the customer?s own risk. applications ? applications that are described herein for any of these products are for illustrative purpos es only. nxp semiconductors makes no representation or warranty that such applications will be suitable for the specified use without further testing or modification. customers are responsible for the design and operation of their applications and products using nxp semiconductors products, and nxp semiconductors accepts no liability for any assistance with applications or customer product design. it is customer?s sole responsibility to determine whether the nxp semiconductors product is suitable and fit for the customer?s applications and products planned, as well as fo r the planned application and use of customer?s third party customer(s). customers should provide appropriate design and operating safeguards to minimize the risks associated with their applications and products. nxp semiconductors does not accept any liability related to any default, damage, costs or problem which is based on any weakness or default in the customer?s applications or products, or the application or use by customer?s third party customer(s). customer is responsible for doing all necessary testing for the customer?s applic ations and products using nxp semiconductors products in order to av oid a default of the applications and the products or of the application or use by customer?s third party customer(s). nxp does not accept any liability in this respect. export control ? this document as well as the item(s) described herein may be subject to export control regulations. export might require a prior authorization from competent authorities. 27.3.3 trademarks notice: all referenced brands, produc t names, service names and trademarks are the property of their respective owners. i 2 c-bus ? logo is a trademark of nxp b.v.
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 300 of 313 nxp semiconductors um10601 chapter 27: supplementary information 27.4 tables table 1. ordering information . . . . . . . . . . . . . . . . . . . . .5 table 2. ordering options . . . . . . . . . . . . . . . . . . . . . . . . .5 table 3. connection of interrupt sources to the nvic . .10 table 4. syscon pin description . . . . . . . . . . . . . . . . .15 table 5. register overview: system configuration (base address 0x4004 8000) . . . . . . . . . . . . . . . . . .17 table 6. system memory remap register (sysmemremap, address 0x4004 8000) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . . .19 table 7. peripheral reset control register (presetctrl, address 0x4004 8004) bit description. . . . . . . .19 table 8. system pll cont rol register (syspllctrl, address 0x4004 8008) bit description . . . . . . .21 table 9. system pll status register (syspllstat, address 0x4004 800c) bit description . . . . . . .21 table 10. system oscillator co ntrol register (sysoscctrl, address 0x4004 8020) bit description. . . . . . . .21 table 11. watchdog oscillator control register (wdtoscctrl, address 0x4004 8024) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . . .22 table 12. system reset stat us register (sysrststat, address 0x4004 8030) bit description. . . . . . . .23 table 13. system pll clock source select register (syspllclksel, addre ss 0x4004 8040) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . . .23 table 14. system pll clock source update enable register (syspllclkuen, address 0x4004 8044) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . . .24 table 15. main clock source select register (mainclksel, address 0x4004 8070) bit description. . . . . . . .24 table 16. main clock source update enable register (mainclkuen, address 0x4004 8074) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . . .24 table 17. system clock divi der register (sysahbclkdiv, address 0x4004 8078) bit description. . . . . . . .25 table 18. system clock control register (sysahbclkctrl, address 0x4004 8080) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . .25 table 19. usart clock divider register (uartclkdiv, address 0x4004 8094) bit description. . . . . . . .27 table 20. clkout clock so urce select register (clkoutsel, address 0x4004 80e0) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . . .27 table 21. clkout clock source update enable register (clkoutuen, address 0x4004 80e4) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . . .28 table 22. clkout clock divi der registers (clkoutdiv, address 0x4004 80e8) bit description . . . . . . .28 table 23. usart fractional gener ator divider value register (uartfrgdiv, address 0x4004 80f0) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . . .29 table 24. usart fractional generator multiplier value register (uartfrgmult, address 0x4004 80f4) bit description . . . . . . . . . . . . . . . . . . . . . . . . . .29 table 25. external trace buffer command register (exttracecmd, address 0x4004 80fc) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 table 26. por captured pio status register 0 (pioporcap0, address 0x4004 8100) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 table 27. iocon glitch filter clock divider registers 6 to 0 (ioconclkdiv[6:0], address 0x4004 8134 (ioconclkdiv6) to 0x004 814c (ioconfiltclkdiv0)) bit description . . . . . . 30 table 28. bod control register (bodctrl, address 0x4004 8150) bit description. . . . . . . . . . . . . . . . . . . . . 30 table 29. system tick timer calibration register (systckcal, addre ss 0x4004 8154) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 table 30. irq latency register (irqlatency, address 0x4004 8170) bit description . . . . . . . . . . . . . . 32 table 31. nmi source selection register (nmisrc, address 0x4004 8174) bit description . . . . . . . . . . . . . . 32 table 32. pin interrupt select registers (pintsel[0:7], address 0x4004 8178 (pintsel0) to 0x4004 8194 (pintsel7)) bit description . . . . . . . . . . 33 table 33. start logic 0 pin wake-up enable register 0 (starterp0, address 0x4004 8204) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 table 34. start logic 1 interrupt wake-up enable register (starterp1, address 0x4004 8214) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 table 35. deep-sleep configuration register (pdsleepcfg, address 0x4004 8230) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 table 36. wake-up configurat ion register (pdawakecfg, address 0x4004 8234) bit description . . . . . . 36 table 37. power configuration register (pdruncfg, address 0x4004 8238) bit description . . . . . . 37 table 38. device id register (device_id, address 0x4004 83f4) bit description . . . . . . . . . . . . . . . . . . . . 38 table 39. pll frequency parameters. . . . . . . . . . . . . . . . 39 table 40. pll configuration examples. . . . . . . . . . . . . . . 40 table 41. wake-up sources for reduced power modes . . 43 table 42. register overview: pmu (base address 0x4002 0000) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 table 43. power control register (pcon, address 0x4002 0000) bit description . . . . . . . . . . . . . . . . . . . . 44 table 44. general purpose registers 0 to 3 (gpreg[0:3], address 0x4002 0004 (gpreg0) to 0x4002 0010 (gpreg3)) bit description . . . . . . . . . . . . . . . 44 table 45. deep power down control register (dpdctrl, address 0x4002 0014) bit description . . . . . . 45 table 46. peripheral configuration in reduced power modes 46 table 47. pinout summary . . . . . . . . . . . . . . . . . . . . . . . . 53 table 48. register overview: i/o configuration (base address 0x4004 4000) . . . . . . . . . . . . . . . . . . . 57 table 49. pio0_17 register (pio0_17, address 0x4004 4000) bit description. . . . . . . . . . . . . . . . . . . . . 57 table 50. pio0_13 register (pio0_13, address 0x4004 4004) bit description . . . . . . . . . . . . . . . . . . . . 59
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 301 of 313 nxp semiconductors um10601 chapter 27: supplementary information table 51. pio0_12 register (pio0_12, address 0x4004 4008) bit description . . . . . . . . . . . . . . . . . . . .60 table 52. pio0_5 register (p io0_5, address 0x4004 400c) bit description . . . . . . . . . . . . . . . . . . . . . . . . .61 table 53. pio0_4 register (p io0_4, address 0x4004 4010) bit description . . . . . . . . . . . . . . . . . . . . . . . . .62 table 54. pio0_3 register (p io0_3, address 0x4004 4014) bit description . . . . . . . . . . . . . . . . . . . . . . . . .63 table 55. pio0_2 register (p io0_2, address 0x4004 4018) bit description . . . . . . . . . . . . . . . . . . . . . . . . .64 table 56. pio0_11 register (pio0_11, address 0x4004 401c) bit description. . . . . . . . . . . . . . . . . . . . .65 table 57. pio0_10 register (pio0_10, address 0x4004 4020) bit description . . . . . . . . . . . . . . . . . . . .66 table 58. pio0_16 register (pio0_16, address 0x4004 4024) bit description . . . . . . . . . . . . . . . . . . . .67 table 59. pio0_15 register (pio0_15, address 0x4004 4028) bit description . . . . . . . . . . . . . . . . . . . .68 table 60. pio0_1 register (p io0_1, address 0x4004 402c) bit description . . . . . . . . . . . . . . . . . . . . . . . . .69 table 61. pio0_9 register (p io0_9, address 0x4004 4034) bit description . . . . . . . . . . . . . . . . . . . . . . . . .70 table 62. pio0_8 register (p io0_8, address 0x4004 4038) bit description . . . . . . . . . . . . . . . . . . . . . . . . .71 table 63. pio0_7 register (p io0_7, address 0x4004 403c) bit description . . . . . . . . . . . . . . . . . . . . . . . . .72 table 64. pio0_6 register (p io0_6, address 0x4004 4040) bit description . . . . . . . . . . . . . . . . . . . . . . . . .73 table 65. pio0_0 register (p io0_0, address 0x4004 4044) bit description . . . . . . . . . . . . . . . . . . . . . . . . .74 table 66. pio0_14 register (pio0_14, address 0x4004 4048) bit description . . . . . . . . . . . . . . . . . . . .75 table 67. gpio pins available . . . . . . . . . . . . . . . . . . . . .76 table 68. register overview: gpio port (base address 0xa000 0000) . . . . . . . . . . . . . . . . . . . . . . . . . .77 table 69. gpio port 0 byte pin registers (b[0:17], addresses 0xa000 0000 (b0) to 0xa000 0012 (b17)) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . . .77 table 70. gpio port 0 word pin registers (w[0:17], addresses 0xa000 1000 (w0) to 0x5000 1048 (w17)) bit description . . . . . . . . . . . . . . . . . . . .78 table 71. gpio direction port 0 register (dir0, address 0xa000 2000) bit description . . . . . . . . . . . . . .78 table 72. gpio mask port 0 register (mask0, address 0xa000 2080) bit description . . . . . . . . . . . . . .78 table 73. gpio port 0 pin register (pin0, address 0xa000 2100) bit description . . . . . . . . . . . . . . . . . . . . .79 table 74. gpio masked port 0 pin register (mpin0, address 0xa000 2180) bit description . . . . . . . . . . . . . .79 table 75. gpio set port 0 regi ster (set0, address 0xa000 2200) bit description . . . . . . . . . . . . . . . . . . . . .79 table 76. gpio clear port 0 r egister (clr0, address 0xa000 2280) bit description . . . . . . . . . . . . . . . . . . . . .80 table 77. gpio toggle port 0 register (not0, address 0xa000 2300) bit description . . . . . . . . . . . . . .80 table 78. sct pin description . . . . . . . . . . . . . . . . . . . . .83 table 79. register overview: pin interrupts/pattern match engine (base address: 0xa000 4000). . . . . . . .86 table 80. pin interrupt mode register (isel, address 0xa000 4000) bit description . . . . . . . . . . . . . 86 table 81. pin interrupt level or rising edge interrupt enable register (ienr, address 0xa000 4004) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 table 82. pin interrupt level or rising edge interrupt set register (sienr, address 0xa000 4008) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 table 83. pin interrupt level or rising edge interrupt clear register (cienr, address 0xa000 400c) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 table 84. pin interrupt active level or falling edge interrupt enable register (ienf, address 0xa000 4010) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 table 85. pin interrupt active level or falling edge interrupt set register (sienf, address 0xa000 4014) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 table 86. pin interrupt active level or falling edge interrupt clear register (cienf, address 0xa000 4018) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 table 87. pin interrupt rising edge register (rise, address 0xa000 401c) bit description . . . . . . . . . . . . . 89 table 88. pin interrupt falling edge register (fall, address 0xa000 4020) bit description . . . . . . . . . . . . . 90 table 89. pin interrupt status register (ist, address 0xa000 4024) bit description . . . . . . . . . . . . . . . . . . . . 90 table 90. pattern match interrupt control register (pmctrl, address 0x4004 c028) bit description. . . . . . . . . . . . . . . . . . . . . . . . . . 91 table 91. pattern match bit-sl ice source register (pmsrc, address 0x4004 c02c) bit description. . . . . . . . . . . . . . . . . . . . . . . . . . 91 table 92. pattern match bit sl ice configuration register (pmcfg, address 0x4004 c030) bit description 94 table 93. pin interrupt registers for edge- and level-sensitive pins . . . . . . . . . . . . . . . . . . . . . 98 table 94. movable functions (assign to pins pio0_0 to pio_17 through switch matrix). . . . . . . . . . . . 102 table 95. register overview: switch matrix (base address 0x4000 c000) . . . . . . . . . . . . . . . . . . . . . . . 104 table 96. pin assign register 0 (pinassign0, address 0x4000 c000) bit description . . . . . . . . . . . . . 105 table 97. pin assign register 1 (pinassign1, address 0x4000 c004) bit description . . . . . . . . . . . . . 105 table 98. pin assign register 2 (pinassign2, address 0x4000 c008) bit description . . . . . . . . . . . . . 106 table 99. pin assign register 3 (pinassign3, address 0x4000 c00c) bit description. . . . . . . . . . . . . 106 table 100. pin assign regist er 4 (pinassign4, address 0x4000 c010) bit description . . . . . . . . . . . . . 106 table 101. pin assign regist er 5 (pinassign5, address 0x4000 c014) bit description . . . . . . . . . . . . . 107 table 102. pin assign regist er 6 (pinassign6, address 0x4000 c018) bit description . . . . . . . . . . . . . 107 table 103. pin assign regist er 7 (pinassign7, address 0x4000 c01c) bit description. . . . . . . . . . . . . 108 table 104. pin assign regist er 8 (pinassign8, address
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 302 of 313 nxp semiconductors um10601 chapter 27: supplementary information 0x4000 c020) bit description . . . . . . . . . . . . .108 table 105. pin enable register 0 (pinenable0, address 0x4000 c1c0) bit description . . . . . . . . . . . . .108 table 106. sct pin description . . . . . . . . . . . . . . . . . . . . 112 table 107. register overview: state configurable timer (base address 0x5000 4000) . . . . . . . . . . . . 115 table 108. sct configuration register (config, address 0x5000 4000) bit description . . . . . . . . . . . . 117 table 109. sct control register (ctrl, address 0x5000 4004) bit description . . . . . . . . . . . . . . . . . . . . 118 table 110. sct limit register (limit, address 0x5000 4008) bit description . . . . . . . . . . . . . . . . . . . . . . . . .120 table 111. sct halt condition register (halt, address 0x5004 400c) bit description . . . . . . . . . . . .120 table 112. sct stop condition register (stop, address 0x5000 4010) bit description . . . . . . . . . . . .121 table 113. sct start condition register (start, address 0x5000 4014) bit description . . . . . . . . . . . .121 table 114. sct counter register (count, address 0x5000 4040) bit description . . . . . . . . . . . . . . . . . . . .122 table 115. sct state register (state, address 0x5000 4044) bit description . . . . . . . . . . . . . . . . . . . .122 table 116. sct input register (input, address 0x5000 4048) bit description . . . . . . . . . . . . . . . . . . . .123 table 117. sct match/captur e registers mode register (regmode, address 0x5000 404c) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . .124 table 118. sct output register (output, address 0x5000 4050) bit description . . . . . . . . . . . . . . . . . . . .124 table 119. sct bidirectional output control register (outputdirctrl, address 0x5000 4054) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . .124 table 120. sct conflict resolution register (res, address 0x5000 4058) bit description . . . . . . . . . . . .125 table 121. sct flag enable register (even, address 0x5000 40f0) bit description . . . . . . . . . . . . . . . . . . . .126 table 122. sct event flag register (evflag, address 0x5000 40f4) bit description . . . . . . . . . . . . .126 table 123. sct conflict enable register (conen, address 0x5000 40f8) bit description . . . . . . . . . . . . .126 table 124. sct conflict flag register (conflag, address 0x5000 40fc) bit description . . . . . . . . . . . . .127 table 125. sct match registers 0 to 4 (match[0:4], address 0x5000 4100 (match0) to 0x5000 4110 (match4)) bit description (regmoden bit = 0) . 127 table 126. sct capture registers 0 to 4 (cap[0:4], address 0x5000 4100 (cap0) to 0x5000 4110 (cap4)) bit description (regmoden bit = 1) . . . . . . . . . .128 table 127. sct match reload registers 0 to 4 (matchrel[0:4], address 0x5000 4200 (matchrel0) to 0x5000 4210 (matchrel4) bit description (regmoden bit = 0) . . . . . . . . . .128 table 128. sct capture control registers 0 to 4 (capctrl[0:4], address 0x5000 4200 (capctrl0) to 0x5000 4210 (capctrl4)) bit description (regmoden bit = 1) . . . . . . . . . .128 table 129. sct event state mask registers 0 to 5 (ev[0:5]_state, addresses 0x5000 4300 (ev0_state) to 0x5000 4328 (ev5_state)) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 table 130. sct event control regi ster 0 to 5 (ev[0:5]_ctrl, address 0x5000 4304 (ev0_ctrl) to 0x5000 432c (ev5_ctrl)) bit descr iption . . . . . . . . 129 table 131. sct output set register (out[0:3]_set, address 0x5000 4500 (out0_set) to 0x5000 4518 (out3_set)) bit description . . . . . . . . . . . . . 131 table 132. sct output clear register (out[0:3]_clr, address 0x5000 0504 (out0_clr) to 0x5000 051c (out3_clr)) bit description . . . . . . . . 131 table 133. event conditions . . . . . . . . . . . . . . . . . . . . . . 134 table 134. register overview: mrt (base address 0x4000 4000) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 table 135. time interval register (intval[0:3], address 0x4000 4000 (intval0) to 0x4000 4030 (intval3)) bit description . . . . . . . . . . . . . . . 142 table 136. timer register (timer[0:3], address 0x4000 4004 (timer0) to 0x4000 4034 (timer3)) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 table 137. control register (ctrl[0:3], address 0x4000 4008 (ctrl0) to 0x4000 4038 (ctrl3)) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 table 138. status register (stat[0:3], address 0x4000 400c (stat0) to 0x4000 403c (stat3)) bit description 144 table 139. idle channel register (idle_ch, address 0x4000 40f4) bit description . . . . . . . . . . . . . . . . . . . 144 table 140. global interrupt flag register (irq_flag, address 0x4000 40f8) bit description . . . . . . . . . . . . . 145 table 141. register overview: watchdog timer (base address 0x4000 4000) . . . . . . . . . . . . . . . . . . 150 table 142. watchdog mode register (mod - 0x4000 4000) bit description. . . . . . . . . . . . . . . . . . . . . . . . . 150 table 143. watchdog operating modes selection . . . . . . 152 table 144. watchdog timer constant register (tc - 0x4000 4004) bit description. . . . . . . . . . . . . . . . . . . . 152 table 145. watchdog feed register (feed - 0x4000 4008) bit description. . . . . . . . . . . . . . . . . . . . . . . . . 153 table 146. watchdog timer value register (tv - 0x4000 400c) bit description . . . . . . . . . . . . . . . . . . . 153 table 147. watchdog timer warning interrupt register (warnint - 0x4000 4014) bit description. . . 153 table 148. watchdog timer window register (window - 0x4000 4018) bit description . . . . . . . . . . . . . 154 table 149. analog comparator pin description . . . . . . . . 156 table 150. register overview: analog comparator (base address 0x4002 4000) . . . . . . . . . . . . . . . . . . 158 table 151. comparator contro l register (ctrl, address 0x4002 4000) bit description . . . . . . . . . . . . . 158 table 152. voltage ladder register (lad, address 0x4002 4004) bit description. . . . . . . . . . . . . . . . . . . . 160 table 153. register overview: wkt (base address 0x4000 8000) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 table 154. control register (ctrl, address 0x4000 8000) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 table 155. counter register (count, address 0x4000 800c)
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 303 of 313 nxp semiconductors um10601 chapter 27: supplementary information bit description . . . . . . . . . . . . . . . . . . . . . . . . .163 table 156. usart pin description. . . . . . . . . . . . . . . . . .167 table 157: register overview: usart (base address 0x4006 4000 (usart0), 0x4006 8000 (usart1), 0x4006 c000 (usart2)) . . . . . . . . . . . . . . . .170 table 158. usart configuration register (cfg, address 0x4006 4000 (usart0), 0x4006 8000 (usart1), 0x4006 c000 (usart2)) bit description . . .171 table 159. usart control register (ctrl, address 0x4006 4004 (usart0), 0x4006 8004 (usart1), 0x4006 c004 (usart2)) bit description . . . . . . . . . . .173 table 160. usart status register (stat, address 0x4006 4008 (usart0), 0x4006 8008 (usart1), 0x4006 c008(usart2)) bit description . . . . . . . . . . .174 table 161. usart interrupt enable read and set register (intenset, address 0x4006 400c(usart0), 0x4006 800c (usart1), 0x4006 c00c(usart2)) bit description . . . . . . . . . .175 table 162. usart interrupt enable clear register (intenclr, address 0x4006 4010(usart0), 0x4006 8010 (usart1), 0x4006 c010(usart2)) bit description . . . . . . . . . . . . . . . . . . . . . . . .176 table 163. usart receiver data register (rxdata, address 0x4006 4014 (usart0), 0x4006 8014 (usart1), 0x4006 c014 (usart2)) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . .177 table 164. usart receiver data with status register (rxdatastat, address 0x4006 4018 (usart0), 0x4006 8018 (usart1), 0x4006 c018 (usart2)) bit description. . . . . . . . . . . . . . . .177 table 165. usart transmitter data register (txdata, address 0x4006 401c (usart0), 0x4006 801c (usart1), 0x4006 c01c (usart2)) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . .178 table 166. usart baud rate generator register (brg, address 0x4006 4020 (usart0), 0x4006 8020 (usart1), 0x4006 c020 (usart2)) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . .179 table 167. usart interrupt status register (intstat, address 0x4006 4024 (usart0), 0x4006 8024 (usart1), 0x4006 c024(usart2)) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . .179 table 168. i2c-bus pin description . . . . . . . . . . . . . . . . .184 table 169: register overview: i2c (base address 0x4005 0000) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .187 table 170. i2c configuration register (cfg, address 0x4005 0000) bit description . . . . . . . . . . . . . . . . . . . .187 table 171. i 2 c status register (stat, address 0x4005 0004) bit description . . . . . . . . . . . . . . . . . . . . . . . .189 table 172: master function state codes (mststate) . . .192 table 173: slave function state codes (slvstate) . . . .192 table 174. interrupt enable set and read register (intenset, address 0x4005 0008) bit description 193 table 175. interrupt enable clear register (intenclr, address 0x4005 000c) bit description . . . . . . . . . . . . . . . . . . . . . . . . . .194 table 176. time-out register (timeout, address 0x4005 0010) bit description. . . . . . . . . . . . . . . . . . . . 196 table 177. i 2 c clock divider register (div, address 0x4005 0014) bit description. . . . . . . . . . . . . . . . . . . . 196 table 178. i 2 c interrupt status register (intstat, address 0x4005 0018) bit description . . . . . . . . . . . . . 197 table 179. master control register (mstctl, address 0x4005 0020) bit description . . . . . . . . . . . . . 197 table 180. master time register (msttime, address 0x4005 0024) bit description . . . . . . . . . . . . . . . . . . . 198 table 181. master data register (mstdat, address 0x4005 0028) bit description. . . . . . . . . . . . . . . . . . . . 199 table 182. slave control register (slvctl, address 0x4005 0040) bit description. . . . . . . . . . . . . . . . . . . . 200 table 183. slave data register (slvdat, address 0x4005 0044) bit description. . . . . . . . . . . . . . . . . . . . 200 table 184. slave address registers (slvadr[0:3]- address 0x4005 0048 (slvadr0) to 0x4005 0054 (slvadr3)) bit description . . . . . . . . . . . . . . 201 table 185. slave address qualifier 0 register (slvqual0, address 0x4005 0058) bit description . . . . . . 202 table 186. monitor data register (monrxdat, address 0x4005 0080) bit description . . . . . . . . . . . . . 202 table 187: spi pin description . . . . . . . . . . . . . . . . . . . . 208 table 188. register overview: spi (base address 0x4005 8000 (spi0) and 0x4008 c000 (spi1)) . . . . . 209 table 189. spi configuration register (cfg, addresses 0x4005 8000 (spi0) , 0x4005 c000 (spi1)) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . 211 table 190. spi delay register (dly, addresses 0x4005 8004 (spi0) , 0x4005 c004 (spi1)) bit description. 212 table 191. spi status register (stat, addresses 0x4005 8008 (spi0) , 0x4005 c008 (spi1)) bit description 213 table 192. spi interrupt enable read and set register (intenset, addresses 0x4005 800c (spi0) , 0x4005 c00c (spi1)) bit description . . . . . . . 214 table 193. spi interrupt enable clear register (intenclr, addresses 0x4005 8010 (spi0) , 0x4005 c010 (spi1)) bit description . . . . . . . . . . . . . . . . . . 215 table 194. spi receiver data register (rxdat, addresses 0x4005 8014 (spi0) , 0x4005 c014 (spi1)) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 table 195. spi transmitter data and control register (txdatctl, addresses 0x4005 8018 (spi0) , 0x4005 c018 (spi1)) bit description . . . . . . . 216 table 196. spi transmitter data register (txdat, addresses 0x4005 801st (spi0) , 0x4005 c00c (spi1)) bit description . . . . . . . . . . . . . . . . . . 217 table 197. spi transmitter control register (txctl, addresses 0x4005 8020 (spi0) , 0x4005 c020 (spi1)) bit description . . . . . . . . . . . . . . . . . . 218 table 198. spi divider regist er (div, addresses 0x4005 8024 (spi0) , 0x4005 c024(spi1)) bit description . 218 table 199. spi interrupt status register (intstat, addresses 0x4005 8028 (spi0) , 0x4005 c028 (spi1)) bit description . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 table 200: spi mode summary. . . . . . . . . . . . . . . . . . . . 220 table 201. register overview: crc engine (base address
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 304 of 313 nxp semiconductors um10601 chapter 27: supplementary information 0x5000 0000) . . . . . . . . . . . . . . . . . . . . . . . . .228 table 202. crc mode register (mode, address 0x5000 0000) bit description . . . . . . . . . . . . . . . . . . . .229 table 203. crc seed register (seed, address 0x5000 0004) bit description . . . . . . . . . . . . . . . . . . . .229 table 204. crc checksum register (sum, address 0x5000 0008) bit description . . . . . . . . . . . . . . . . . . . .229 table 205. crc data register (wr_data, address 0x5000 0008) bit description . . . . . . . . . . . . . . . . . . . .230 table 206. register overview: fmc (base address 0x4004 0000) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .232 table 207. flash configuration register (flashcfg, address 0x4003 c010) bit description . . . . . .233 table 208. flash module signature start register (fmsstart - 0x4003 c020) bit description .233 table 209. flash module signature stop register (fmsstop - 0x4003 c024) bit description . . . . . . . . . . . .233 table 210. fmsw0 register bit description (fmsw0, address: 0x4003 c02c) . . . . . . . . . . . . . . . . .234 table 211. api calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . .237 table 212. lpc800 flash configurations . . . . . . . . . . . . .240 table 213. lpc800 flash configuration . . . . . . . . . . . . . .240 table 214. code read protection options . . . . . . . . . . . .242 table 215. code read protection hardware/software interaction . . . . . . . . . . . . . . . . . . . . . . . . . . . .242 table 216. isp commands allowed for different crp levels . 243 table 217. uart isp command summary . . . . . . . . . . .244 table 218. uart isp unlock command . . . . . . . . . . . . .244 table 219. uart isp set baud rate command . . . . . . .244 table 220. uart isp echo command . . . . . . . . . . . . . .245 table 221. uart isp write to ram command . . . . . . . .245 table 222. uart isp read memory command . . . . . . .246 table 223. uart isp prepare sector(s) for write operation command . . . . . . . . . . . . . . . . . . . . . . . . . . . .246 table 224. uart isp copy ram to flash command. . . .247 table 225. uart isp go command . . . . . . . . . . . . . . . .247 table 226. uart isp erase sector command . . . . . . . .248 table 227. uart isp blank check sector command . . .248 table 228. uart isp read part identification command248 table 229. part identification numbers . . . . . . . . . . . . . .249 table 230. uart isp read boot code version number command . . . . . . . . . . . . . . . . . . . . . . . . . . . .249 table 231. uart isp compare command . . . . . . . . . . .249 table 232. uart isp readuid command . . . . . . . . . . .249 table 233. uart isp return codes summary. . . . . . . .250 table 234. iap command summary . . . . . . . . . . . . . . . .252 table 235. iap prepare sector(s) for write operation command . . . . . . . . . . . . . . . . . . . . . . . . . . . .252 table 236. iap copy ram to flash command . . . . . . . . .253 table 237. iap erase sector(s) command . . . . . . . . . . .254 table 238. iap blank check sector(s) command . . . . . . .254 table 239. iap read part identification command . . . . .254 table 240. iap read boot code version number command . 255 table 241. iap compare command. . . . . . . . . . . . . . . . .255 table 242. iap reinvoke isp . . . . . . . . . . . . . . . . . . . . .256 table 243. iap readuid command. . . . . . . . . . . . . . . . .256 table 244. iap erase page command . . . . . . . . . . . . . . 256 table 245. iap status codes summary . . . . . . . . . . . . . 256 table 246. memory mapping in debug mode . . . . . . . . . 258 table 247. power profile api calls . . . . . . . . . . . . . . . . . 261 table 248. set_pll routine . . . . . . . . . . . . . . . . . . . . . . . . 261 table 249. set_power routine . . . . . . . . . . . . . . . . . . . . . 264 table 250. i2c api calls . . . . . . . . . . . . . . . . . . . . . . . . . 269 table 251. isr handler . . . . . . . . . . . . . . . . . . . . . . . . . . 271 table 252. i2c master transmit polling . . . . . . . . . . . . . 271 table 253. i2c master receive polling . . . . . . . . . . . . . 271 table 254. i2c master transmit and receive polling . . . 272 table 255. i2c master transmit interrupt . . . . . . . . . . . . 272 table 256. i2c master receive interrupt . . . . . . . . . . . . 272 table 257. i2c master transmit receive interrupt . . . . . 273 table 258. i2c slave receive polling. . . . . . . . . . . . . . . 273 table 259. i2c slave transmit polling . . . . . . . . . . . . . . 273 table 260. i2c slave receive interrupt . . . . . . . . . . . . . 274 table 261. i2c slave transmit interrupt . . . . . . . . . . . . . 274 table 262. i2c set slave address . . . . . . . . . . . . . . . . . 274 table 263. i2c get memory size . . . . . . . . . . . . . . . . . . 274 table 264. i2c setup . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 table 265. i2c set bit rate . . . . . . . . . . . . . . . . . . . . . . 275 table 266. i2c get firmware version. . . . . . . . . . . . . . . 275 table 267. i2c get status . . . . . . . . . . . . . . . . . . . . . . . 275 table 268. i2c time-out value . . . . . . . . . . . . . . . . . . . . . 276 table 269. error codes . . . . . . . . . . . . . . . . . . . . . . . . . . 276 table 270. i2c status code. . . . . . . . . . . . . . . . . . . . . . . 276 table 271. uart api calls . . . . . . . . . . . . . . . . . . . . . . . 285 table 272. uart_get_mem_size. . . . . . . . . . . . . . . . . . . . 285 table 273. uart_setup . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 table 274. uart_init . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 table 275. uart_get_char . . . . . . . . . . . . . . . . . . . . . . . . 286 table 276. uart_put_char . . . . . . . . . . . . . . . . . . . . . . . . 286 table 277. uart_get_line . . . . . . . . . . . . . . . . . . . . . . . . . 287 table 278. uart_put_line . . . . . . . . . . . . . . . . . . . . . . . . . 287 table 279. uart_isr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287 table 280. error codes . . . . . . . . . . . . . . . . . . . . . . . . . . 287 table 281. swd pin description . . . . . . . . . . . . . . . . . . . 290 table 282. jtag boundary scan pin description. . . . . . . 291 table 283. pin description table (fixed pins) . . . . . . . . . . 295 table 284. movable functions (assign to pins pio0_0 to pio_17 through switch matrix). . . . . . . . . . . . 296 table 285. abbreviations . . . . . . . . . . . . . . . . . . . . . . . . 298
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 305 of 313 nxp semiconductors um10601 chapter 27: supplementary information 27.5 figures fig 1. lpc800 block diagram . . . . . . . . . . . . . . . . . . . . .6 fig 2. lpc800 memory mapping . . . . . . . . . . . . . . . . . . .9 fig 3. lpc800 clock generation. . . . . . . . . . . . . . . . . . .16 fig 4. system pll block diagram . . . . . . . . . . . . . . . . .38 fig 5. pin configuration . . . . . . . . . . . . . . . . . . . . . . . . .54 fig 6. pattern match bit slice . . . . . . . . . . . . . . . . . . . . .85 fig 7. example: connect function u0_rxd and u0_txd to pins 8 and 14 on the so20 package . . . . . . .101 fig 8. sct block diagram . . . . . . . . . . . . . . . . . . . . . . 113 fig 9. sct counter and select logi c . . . . . . . . . . . . . . . 114 fig 10. match logic. . . . . . . . . . . . . . . . . . . . . . . . . . . . .132 fig 11. capture logic . . . . . . . . . . . . . . . . . . . . . . . . . . .132 fig 12. event selection . . . . . . . . . . . . . . . . . . . . . . . . .133 fig 13. output slice i . . . . . . . . . . . . . . . . . . . . . . . . . . .133 fig 14. sct interrupt generation . . . . . . . . . . . . . . . . . .133 fig 15. mrt block diagram . . . . . . . . . . . . . . . . . . . . . .140 fig 16. windowed watchdog timer block diagram. . . . .148 fig 17. early watchdog feed with windowed mode enabled 154 fig 18. correct watchdog feed with windowed mode enabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .154 fig 19. watchdog warning interrupt . . . . . . . . . . . . . . . .154 fig 20. comparator block diagram. . . . . . . . . . . . . . . . .157 fig 21. usart clocking. . . . . . . . . . . . . . . . . . . . . . . . .166 fig 22. usart block diagram . . . . . . . . . . . . . . . . . . . .169 fig 23. hardware flow control using rts and cts . . . .182 fig 24. i2c clocking . . . . . . . . . . . . . . . . . . . . . . . . . . . .183 fig 25. i2c block diagram . . . . . . . . . . . . . . . . . . . . . . .185 fig 26. spi clocking . . . . . . . . . . . . . . . . . . . . . . . . . . . .206 fig 27. spi block diagram . . . . . . . . . . . . . . . . . . . . . . .209 fig 28. basic spi operating modes . . . . . . . . . . . . . . . .220 fig 29. pre_delay and post_delay . . . . . . . . . . . . . . . . .221 fig 30. frame_delay . . . . . . . . . . . . . . . . . . . . . . . . . . .222 fig 31. transfer_delay . . . . . . . . . . . . . . . . . . . . . . . . . .223 fig 32. examples of data stalls . . . . . . . . . . . . . . . . . . .226 fig 33. crc block diagram . . . . . . . . . . . . . . . . . . . . . .228 fig 34. boot rom structure . . . . . . . . . . . . . . . . . . . . . .237 fig 35. boot process flowchart . . . . . . . . . . . . . . . . . . .239 fig 36. iap parameter passing . . . . . . . . . . . . . . . . . . .252 fig 37. power profiles pointer structure . . . . . . . . . . . . .260 fig 38. lpc800 clock configuration for power api use .260 fig 39. power profiles usage . . . . . . . . . . . . . . . . . . . . .264 fig 40. i2c-bus driver routines pointer structure . . . . . .269 fig 41. i2c slave mode set-up address packing . . . . . .279 fig 42. usart driver routines pointer structure . . . . . .284 fig 43. connecting the swd pins to a standard swd connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .292 fig 44. pin configuration di p8 package (lpc810m021fn8) 293 fig 45. pin configuration tssop16 package . . . . . . . .293 fig 46. pin configuration so20 package (lpc812m101fd20) . . . . . . . . . . . . . . . . . . . . .293 fig 47. pin configuration tssop20 package . . . . . . . .294
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 306 of 313 nxp semiconductors um10601 chapter 27: supplementary information 27.6 contents chapter 1: lpc800 introductory information 1.1 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.3 ordering information . . . . . . . . . . . . . . . . . . . . . 5 1.4 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.5 general description . . . . . . . . . . . . . . . . . . . . . 7 1.5.1 arm cortex-m0+ core conf iguration . . . . . . . . 7 chapter 2: lpc800 memory mapping 2.1 how to read this chapter . . . . . . . . . . . . . . . . . . 8 2.2 general description . . . . . . . . . . . . . . . . . . . . . . 8 2.2.1 memory mapping . . . . . . . . . . . . . . . . . . . . . . . 9 2.2.2 micro trace buffer (mtb). . . . . . . . . . . . . . . . . 9 chapter 3: lpc800 nested vectored interrupt controller (nvic) 3.1 how to read this chapter . . . . . . . . . . . . . . . . . 10 3.2 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.3 general description . . . . . . . . . . . . . . . . . . . . 10 3.3.1 interrupt sources . . . . . . . . . . . . . . . . . . . . . . 10 chapter 4: lpc800 system configuration (syscon) 4.1 how to read this chapter . . . . . . . . . . . . . . . . . 13 4.2 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 4.3 basic configuration . . . . . . . . . . . . . . . . . . . . . 13 4.3.1 set up the pll . . . . . . . . . . . . . . . . . . . . . . . . 13 4.3.2 configure the main clock and system clock . . 14 4.3.3 set up the system oscillator using xtalin and xtalout . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 4.4 pin description . . . . . . . . . . . . . . . . . . . . . . . . . 15 4.5 general description . . . . . . . . . . . . . . . . . . . . . 15 4.5.1 clock generation. . . . . . . . . . . . . . . . . . . . . . . 15 4.5.2 power control of analog components . . . . . . . 16 4.5.3 configuration of reduced power-modes . . . . . 17 4.5.4 reset and interrupt control . . . . . . . . . . . . . . . 17 4.6 register description . . . . . . . . . . . . . . . . . . . . 17 4.6.1 system memory remap register . . . . . . . . . . . 19 4.6.2 peripheral reset control register . . . . . . . . . . . 19 4.6.3 system pll control register . . . . . . . . . . . . . . 20 4.6.4 system pll status register. . . . . . . . . . . . . . . 21 4.6.5 system oscillator control register . . . . . . . . . . 21 4.6.6 watchdog oscillator control register . . . . . . . . 22 4.6.7 system reset status register . . . . . . . . . . . . . . 23 4.6.8 system pll clock source select register . . . . 23 4.6.9 system pll clock source update register . . . 24 4.6.10 main clock sour ce select register . . . . . . . . . . 24 4.6.11 main clock source update enable register . . . 24 4.6.12 system clock divider register . . . . . . . . . . . . . 25 4.6.13 system clock control regist er . . . . . . . . . . . . . 25 4.6.14 usart clock divider regist er . . . . . . . . . . . . . 27 4.6.15 clkout clock source select register. . . . . . . 27 4.6.16 clkout clock source update enable register 27 4.6.17 clkout clock divider register. . . . . . . . . . . . 28 4.6.18 usart fractional generator divider value register 28 4.6.19 usart fractional generator multiplier value register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 4.6.20 external trace buffer command register . . . . 29 4.6.21 por captured pio status register 0 . . . . . . . 30 4.6.22 iocon glitch filter clock divider registers 6 to 0 . 30 4.6.23 bod control register . . . . . . . . . . . . . . . . . . . 30 4.6.24 system tick counter calibration register . . . . . 31 4.6.25 irq latency register . . . . . . . . . . . . . . . . . . . . 31 4.6.26 nmi source selection register . . . . . . . . . . . . 32 4.6.27 pin interrupt select registers . . . . . . . . . . . . . 32 4.6.28 start logic 0 pin wake-up enable register . . . 33 4.6.29 start logic 1 interrupt wake-up enable register 34 4.6.30 deep-sleep mode configuration register . . . . 35 4.6.31 wake-up configuration register . . . . . . . . . . . 35 4.6.32 power configuration register . . . . . . . . . . . . . 36 4.6.33 device id register . . . . . . . . . . . . . . . . . . . . . 37 4.7 functional description . . . . . . . . . . . . . . . . . . 38 4.7.1 system pll functional description. . . . . . . . . 38 4.7.1.1 lock detector . . . . . . . . . . . . . . . . . . . . . . . . . 39 4.7.1.2 power-down control . . . . . . . . . . . . . . . . . . . . 39 4.7.1.3 divider ratio programming . . . . . . . . . . . . . . . 39 4.7.1.3.1 post divider . . . . . . . . . . . . . . . . . . . . . . . . . . 39 4.7.1.3.2 feedback divider . . . . . . . . . . . . . . . . . . . . . . 39 4.7.1.3.3 changing the divider values. . . . . . . . . . . . . . 39 4.7.1.4 frequency selection. . . . . . . . . . . . . . . . . . . . 39 4.7.1.4.1 normal mode . . . . . . . . . . . . . . . . . . . . . . . . . 40 4.7.1.4.2 power-down mode . . . . . . . . . . . . . . . . . . . . . 40 chapter 5: lpc800 reduced power modes and power management unit (pmu) 5.1 how to read this chapter . . . . . . . . . . . . . . . . . 41 5.2 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 5.3 basic configuration . . . . . . . . . . . . . . . . . . . . . 41 5.4 pin description . . . . . . . . . . . . . . . . . . . . . . . . . 41 5.5 general description . . . . . . . . . . . . . . . . . . . . 41 5.5.1 wake-up process . . . . . . . . . . . . . . . . . . . . . . 42 5.6 register description . . . . . . . . . . . . . . . . . . . . 43 5.6.1 power control register . . . . . . . . . . . . . . . . . . 44
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 307 of 313 nxp semiconductors um10601 chapter 27: supplementary information 5.6.2 general purpose registers 0 to 3 . . . . . . . . . . 44 5.6.3 deep power-down control register . . . . . . . . . 45 5.7 functional description . . . . . . . . . . . . . . . . . . 46 5.7.1 power management . . . . . . . . . . . . . . . . . . . . 46 5.7.2 reduced power modes and wwdt lock features 47 5.7.3 active mode . . . . . . . . . . . . . . . . . . . . . . . . . . 47 5.7.3.1 power configuration in active mode . . . . . . . . 47 5.7.4 sleep mode . . . . . . . . . . . . . . . . . . . . . . . . . . 47 5.7.4.1 power configuration in sleep mode . . . . . . . . 48 5.7.4.2 programming sleep mode . . . . . . . . . . . . . . . 48 5.7.4.3 wake-up from sleep mode . . . . . . . . . . . . . . . 48 5.7.5 deep-sleep mode . . . . . . . . . . . . . . . . . . . . . . 48 5.7.5.1 power configuration in deep-sleep mode . . . 48 5.7.5.2 programming deep-sleep mode . . . . . . . . . . 49 5.7.5.3 wake-up from deep-sleep mode . . . . . . . . . . 49 5.7.6 power-down mode . . . . . . . . . . . . . . . . . . . . . 49 5.7.6.1 power configuration in power-down mode . . 50 5.7.6.2 programming power-down mode . . . . . . . . . 50 5.7.6.3 wake-up from power-down mode . . . . . . . . . 50 5.7.7 deep power-down mode . . . . . . . . . . . . . . . . 51 5.7.7.1 power configuration in deep power-down mode . 51 5.7.7.2 programming deep power-down mode . . . . . 51 5.7.7.3 wake-up from deep power-down mode . . . . 51 chapter 6: lpc800 i/o configuration (iocon) 6.1 how to read this chapter . . . . . . . . . . . . . . . . . 53 6.2 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 6.3 basic configuration . . . . . . . . . . . . . . . . . . . . . 53 6.4 general description . . . . . . . . . . . . . . . . . . . . . 54 6.4.1 pin configuration . . . . . . . . . . . . . . . . . . . . . . . 54 6.4.2 pin function. . . . . . . . . . . . . . . . . . . . . . . . . . . 54 6.4.3 pin mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 6.4.4 open-drain mode . . . . . . . . . . . . . . . . . . . . . . 55 6.4.5 analog mode . . . . . . . . . . . . . . . . . . . . . . . . . 55 6.4.6 i 2 c-bus mode . . . . . . . . . . . . . . . . . . . . . . . . . 55 6.4.7 programmable glitch filter . . . . . . . . . . . . . . . . 55 6.5 register description . . . . . . . . . . . . . . . . . . . . 57 6.5.1 pio0_17 register . . . . . . . . . . . . . . . . . . . . . . 57 6.5.2 pio0_13 register . . . . . . . . . . . . . . . . . . . . . . 59 6.5.3 pio0_12 register . . . . . . . . . . . . . . . . . . . . . . 60 6.5.4 pio0_5 register . . . . . . . . . . . . . . . . . . . . . . . 61 6.5.5 pio0_4 register . . . . . . . . . . . . . . . . . . . . . . . 62 6.5.6 pio0_3 register . . . . . . . . . . . . . . . . . . . . . . . 63 6.5.7 pio0_2 register . . . . . . . . . . . . . . . . . . . . . . . 64 6.5.8 pio0_11 register . . . . . . . . . . . . . . . . . . . . . . 65 6.5.9 pio0_10 register . . . . . . . . . . . . . . . . . . . . . . 66 6.5.10 pio0_16 register . . . . . . . . . . . . . . . . . . . . . . 67 6.5.11 pio0_15 register . . . . . . . . . . . . . . . . . . . . . . 68 6.5.12 pio0_1 register . . . . . . . . . . . . . . . . . . . . . . . 69 6.5.13 pio0_9 register . . . . . . . . . . . . . . . . . . . . . . . 70 6.5.14 pio0_8 register . . . . . . . . . . . . . . . . . . . . . . . 71 6.5.15 pio0_7 register . . . . . . . . . . . . . . . . . . . . . . . 72 6.5.16 pio0_6 register . . . . . . . . . . . . . . . . . . . . . . . 73 6.5.17 pio0_0 register . . . . . . . . . . . . . . . . . . . . . . . 74 6.5.18 pio0_14 register . . . . . . . . . . . . . . . . . . . . . . 75 chapter 7: lpc800 gpio port 7.1 how to read this chapter . . . . . . . . . . . . . . . . . 76 7.2 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 7.3 basic configuration . . . . . . . . . . . . . . . . . . . . . 76 7.4 pin description . . . . . . . . . . . . . . . . . . . . . . . . . 76 7.5 general description . . . . . . . . . . . . . . . . . . . . . 76 7.6 register description . . . . . . . . . . . . . . . . . . . . 77 7.6.1 gpio port byte pin registers . . . . . . . . . . . . . . 77 7.6.2 gpio port word pin registers . . . . . . . . . . . . . 77 7.6.3 gpio port direction registers . . . . . . . . . . . . . 78 7.6.4 gpio port mask registers . . . . . . . . . . . . . . . . 78 7.6.5 gpio port pin registers . . . . . . . . . . . . . . . . . 78 7.6.6 gpio masked port pin registers. . . . . . . . . . . 79 7.6.7 gpio port set registers . . . . . . . . . . . . . . . . . 79 7.6.8 gpio port clear registers . . . . . . . . . . . . . . . . 79 7.6.9 gpio port toggle registers . . . . . . . . . . . . . . . 80 7.7 functional description . . . . . . . . . . . . . . . . . . 80 7.7.1 reading pin state . . . . . . . . . . . . . . . . . . . . . . 80 7.7.2 gpio output . . . . . . . . . . . . . . . . . . . . . . . . . . 80 7.7.3 masked i/o. . . . . . . . . . . . . . . . . . . . . . . . . . . 81 7.7.4 recommended practices . . . . . . . . . . . . . . . . 81 chapter 8: lpc800 pin interrupts/pattern match engine 8.1 how to read this chapter . . . . . . . . . . . . . . . . . 82 8.2 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 8.3 basic configuration . . . . . . . . . . . . . . . . . . . . . 82 8.3.1 configure pins as pin in terrupts or as inputs to the pattern match engine . . . . . . . . . . . . . . . . . . . 83 8.4 pin description . . . . . . . . . . . . . . . . . . . . . . . . . 83 8.5 general description . . . . . . . . . . . . . . . . . . . . . 83 8.5.1 pin interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . 84 8.5.2 pattern match engine . . . . . . . . . . . . . . . . . . . 84 8.5.2.1 example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 8.6 register description . . . . . . . . . . . . . . . . . . . . 86 8.6.1 pin interrupt mode register. . . . . . . . . . . . . . . 86 8.6.2 pin interrupt level or rising edge interrupt enable register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 8.6.3 pin interrupt level or rising edge interrupt set register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 8.6.4 pin interrupt level or rising edge interrupt clear register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 308 of 313 nxp semiconductors um10601 chapter 27: supplementary information 8.6.5 pin interrupt active level or falling edge interrupt enable register . . . . . . . . . . . . . . . . . . . . . . . . 88 8.6.6 pin interrupt active level or falling edge interrupt set register . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 8.6.7 pin interrupt active le vel or falling edge interrupt clear register . . . . . . . . . . . . . . . . . . . . . . . . . . 89 8.6.8 pin interrupt rising edge register. . . . . . . . . . . 89 8.6.9 pin interrupt falling edge register . . . . . . . . . . 90 8.6.10 pin interrupt status register. . . . . . . . . . . . . . . 90 8.6.11 pattern match interrupt control register . . . . 90 8.6.12 pattern match interrupt bit-slice source register. 91 8.6.13 pattern match interrupt bit-slice configuration register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 8.7 functional description . . . . . . . . . . . . . . . . . . 98 8.7.1 pin interrupts . . . . . . . . . . . . . . . . . . . . . . . . . 98 8.7.2 pattern match engine example . . . . . . . . . . . 99 chapter 9: lpc800 switch matrix 9.1 how to read this chapter . . . . . . . . . . . . . . . . 100 9.2 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 9.3 basic configuration . . . . . . . . . . . . . . . . . . . . 100 9.3.1 connect an internal signal to a package pin. 101 9.3.2 enable an analog input or other special function . 101 9.4 general description . . . . . . . . . . . . . . . . . . . . 102 9.4.1 movable functions. . . . . . . . . . . . . . . . . . . . . 102 9.4.2 switch matrix register inte rface. . . . . . . . . . . 103 9.5 register description . . . . . . . . . . . . . . . . . . . 104 9.5.1 pin assign register 0 . . . . . . . . . . . . . . . . . . 105 9.5.2 pin assign register 1 . . . . . . . . . . . . . . . . . . 105 9.5.3 pin assign register 2 . . . . . . . . . . . . . . . . . . 106 9.5.4 pin assign register 3 . . . . . . . . . . . . . . . . . . 106 9.5.5 pin assign register 4 . . . . . . . . . . . . . . . . . . 106 9.5.6 pin assign register 5 . . . . . . . . . . . . . . . . . . 107 9.5.7 pin assign register 6 . . . . . . . . . . . . . . . . . . 107 9.5.8 pin assign register 7 . . . . . . . . . . . . . . . . . . 108 9.5.9 pin assign register 8 . . . . . . . . . . . . . . . . . . 108 9.5.10 pin enable register 0 . . . . . . . . . . . . . . . . . . 108 chapter 10: lpc800 state configurable timer (sct) 10.1 how to read this chapter . . . . . . . . . . . . . . . . 111 10.2 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 10.3 basic configuration . . . . . . . . . . . . . . . . . . . . 111 10.3.1 use the sct as a simple timer . . . . . . . . . . . 111 10.4 pin description . . . . . . . . . . . . . . . . . . . . . . . . 112 10.5 general description . . . . . . . . . . . . . . . . . . . . 112 10.6 register description . . . . . . . . . . . . . . . . . . . 114 10.6.1 sct configuration register . . . . . . . . . . . . . . 117 10.6.2 sct control register . . . . . . . . . . . . . . . . . . . 118 10.6.3 sct limit register . . . . . . . . . . . . . . . . . . . . . 119 10.6.4 sct halt condition register . . . . . . . . . . . . . . 120 10.6.5 sct stop condition register . . . . . . . . . . . . . 120 10.6.6 sct start condition register . . . . . . . . . . . . . 121 10.6.7 sct counter register . . . . . . . . . . . . . . . . . . 121 10.6.8 sct state register. . . . . . . . . . . . . . . . . . . . . 122 10.6.9 sct input register. . . . . . . . . . . . . . . . . . . . . 123 10.6.10 sct match/capture registers mode register . 123 10.6.11 sct output register . . . . . . . . . . . . . . . . . . . 124 10.6.12 sct bidirectional output control register. . . . 124 10.6.13 sct conflict resolution re gister. . . . . . . . . . . 125 10.6.14 sct flag enable register . . . . . . . . . . . . . . . . 126 10.6.15 sct event flag register . . . . . . . . . . . . . . . . . 126 10.6.16 sct conflict enable register . . . . . . . . . . . . . 126 10.6.17 sct conflict flag register . . . . . . . . . . . . . . . 126 10.6.18 sct match registers 0 to 4 (regmoden bit = 0) 127 10.6.19 sct capture registers 0 to 4 (regmoden bit = 1) 127 10.6.20 sct match reload registers 0 to 4 (regmoden bit = 0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 10.6.21 sct capture control registers 0 to 4 (regmoden bit = 1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 10.6.22 sct event state mask registers 0 to 5 . . . . . 129 10.6.23 sct event control registers 0 to 5 . . . . . . . . 129 10.6.24 sct output set registers 0 to 3 . . . . . . . . . . 131 10.6.25 sct output clear registers 0 to 3 . . . . . . . . . 131 10.7 functional description . . . . . . . . . . . . . . . . . 132 10.7.1 match logic. . . . . . . . . . . . . . . . . . . . . . . . . . 132 10.7.2 capture logic . . . . . . . . . . . . . . . . . . . . . . . . 132 10.7.3 event selection. . . . . . . . . . . . . . . . . . . . . . . 132 10.7.4 output generation . . . . . . . . . . . . . . . . . . . . 133 10.7.5 interrupt generation . . . . . . . . . . . . . . . . . . . 133 10.7.6 clearing the prescaler . . . . . . . . . . . . . . . . . 134 10.7.7 match vs. i/o events . . . . . . . . . . . . . . . . . . 134 10.7.8 sct operation . . . . . . . . . . . . . . . . . . . . . . . 135 10.7.9 configure the sct . . . . . . . . . . . . . . . . . . . 135 10.7.9.1 configure the counter . . . . . . . . . . . . . . . . . 135 10.7.9.2 configure the match and capture registers . 135 10.7.9.3 configure events and event responses . . . . 136 10.7.9.4 configure multiple states . . . . . . . . . . . . . . . 137 10.7.9.5 miscellaneous options . . . . . . . . . . . . . . . . . 137 10.7.10 run the sct . . . . . . . . . . . . . . . . . . . . . . . . 137 10.7.11 configure the sct without using states. . . . 138 chapter 11: lpc800 multi-rate timer (mrt) 11.1 how to read this chapter . . . . . . . . . . . . . . . . 139 11.2 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 11.3 basic configuration . . . . . . . . . . . . . . . . . . . . 139 11.4 pin description . . . . . . . . . . . . . . . . . . . . . . . 139 11.5 general description . . . . . . . . . . . . . . . . . . . 139 11.5.1 repeat interrupt mode . . . . . . . . . . . . . . . . . 140
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 309 of 313 nxp semiconductors um10601 chapter 27: supplementary information 11.5.2 one-shot interrupt mode. . . . . . . . . . . . . . . . 141 11.6 register description . . . . . . . . . . . . . . . . . . . 141 11.6.1 time interval register . . . . . . . . . . . . . . . . . . 142 11.6.2 timer register . . . . . . . . . . . . . . . . . . . . . . . . 143 11.6.3 control register . . . . . . . . . . . . . . . . . . . . . . 143 11.6.4 status register . . . . . . . . . . . . . . . . . . . . . . . 144 11.6.5 idle channel register. . . . . . . . . . . . . . . . . . . 144 11.6.6 global interrupt flag regist er. . . . . . . . . . . . . 145 chapter 12: lpc800 windowed watchdog timer (wwdt) 12.1 how to read this chapter . . . . . . . . . . . . . . . . 146 12.2 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 12.3 basic configuration . . . . . . . . . . . . . . . . . . . . 146 12.4 pin description . . . . . . . . . . . . . . . . . . . . . . . . 146 12.5 general description . . . . . . . . . . . . . . . . . . . . 147 12.5.1 block diagram . . . . . . . . . . . . . . . . . . . . . . . . 147 12.5.2 clocking and power control . . . . . . . . . . . . . 148 12.5.3 using the wwdt lock features. . . . . . . . . . . 149 12.5.3.1 disabling the wwdt clock source . . . . . . . . 149 12.5.3.2 changing the wwdt reload value . . . . . . . 149 12.6 register description . . . . . . . . . . . . . . . . . . . 150 12.6.1 watchdog mode register . . . . . . . . . . . . . . . 150 12.6.2 watchdog timer constant register. . . . . . . . 152 12.6.3 watchdog feed register. . . . . . . . . . . . . . . . 152 12.6.4 watchdog timer value regi ster . . . . . . . . . . 153 12.6.5 watchdog timer warning interrupt register . 153 12.6.6 watchdog timer window register . . . . . . . . 153 12.7 functional description . . . . . . . . . . . . . . . . . 154 chapter 13: lpc800 analog comparator 13.1 how to read this chapter . . . . . . . . . . . . . . . . 155 13.2 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 13.3 basic configuration . . . . . . . . . . . . . . . . . . . . 155 13.3.1 connect the comparator output to the sct . 155 13.4 pin description . . . . . . . . . . . . . . . . . . . . . . . . 156 13.5 general description . . . . . . . . . . . . . . . . . . . . 156 13.5.1 reference voltages . . . . . . . . . . . . . . . . . . . 157 13.5.2 settling times . . . . . . . . . . . . . . . . . . . . . . . . 157 13.5.3 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 13.5.4 comparator outputs . . . . . . . . . . . . . . . . . . . 158 13.6 register description . . . . . . . . . . . . . . . . . . . 158 13.6.1 comparator control register . . . . . . . . . . . . . 158 13.6.2 voltage ladder register . . . . . . . . . . . . . . . . . 160 chapter 14: lpc800 self wake-up timer (wkt) 14.1 how to read this chapter . . . . . . . . . . . . . . . . 161 14.2 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 14.3 basic configuration . . . . . . . . . . . . . . . . . . . . 161 14.4 pin description . . . . . . . . . . . . . . . . . . . . . . . . 161 14.5 general descriptio n . . . . . . . . . . . . . . . . . . . 161 14.5.1 wkt clock sources . . . . . . . . . . . . . . . . . . . 161 14.6 register description . . . . . . . . . . . . . . . . . . . 162 14.6.1 control register . . . . . . . . . . . . . . . . . . . . . . 162 14.6.2 count register . . . . . . . . . . . . . . . . . . . . . . . 163 chapter 15: lpc800 usart0/1/2 15.1 how to read this chapter . . . . . . . . . . . . . . . . 164 15.2 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 15.3 basic configuration . . . . . . . . . . . . . . . . . . . . 164 15.3.1 configure the usart clock and baud rate. . 165 15.3.2 configure the usart for wake-up . . . . . . . 166 15.3.2.1 wake-up from sleep mode . . . . . . . . . . . . . . 166 15.3.2.2 wake-up from deep-sleep or power-down mode. 167 15.4 pin description . . . . . . . . . . . . . . . . . . . . . . . . 167 15.5 general description . . . . . . . . . . . . . . . . . . . . 168 15.6 register description . . . . . . . . . . . . . . . . . . . 170 15.6.1 usart configuration register . . . . . . . . . . . 171 15.6.2 usart control register . . . . . . . . . . . . . . . . 172 15.6.3 usart status register . . . . . . . . . . . . . . . . . 174 15.6.4 usart interrupt enable read and set register . . 175 15.6.5 usart interrupt enable clear register . . . . 176 15.6.6 usart receiver data regi ster . . . . . . . . . . 177 15.6.7 usart receiver data with status register . 177 15.6.8 usart transmitter data re gister . . . . . . . 178 15.6.9 usart baud rate gene rator register. . . . . 179 15.6.10 usart interrupt status re gister. . . . . . . . . . 179 15.7 functional description . . . . . . . . . . . . . . . . . 180 15.7.1 clocking and baud rates . . . . . . . . . . . . . . . 180 15.7.1.1 fractional rate genera tor (frg) . . . . . . . . 180 15.7.1.2 baud rate generator (brg) . . . . . . . . . . . . 181 15.7.1.3 baud rate calculations . . . . . . . . . . . . . . . . . 181 15.7.2 synchronous mode . . . . . . . . . . . . . . . . . . . 181 15.7.3 flow control . . . . . . . . . . . . . . . . . . . . . . . . . 181 15.7.3.1 hardware flow control . . . . . . . . . . . . . . . . . 181 15.7.3.2 software flow control . . . . . . . . . . . . . . . . . . 182 chapter 16: lpc800 i2c-bus interface 16.1 how to read this chapter . . . . . . . . . . . . . . . . 183 16.2 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 310 of 313 nxp semiconductors um10601 chapter 27: supplementary information 16.3 basic configuration . . . . . . . . . . . . . . . . . . . . 183 16.4 pin description . . . . . . . . . . . . . . . . . . . . . . . . 184 16.5 general description . . . . . . . . . . . . . . . . . . . . 184 16.6 register description . . . . . . . . . . . . . . . . . . . 185 16.6.1 i2c configuration register . . . . . . . . . . . . . . 187 16.6.2 i2c status register . . . . . . . . . . . . . . . . . . . . 189 16.6.3 interrupt enable set and read register . . . . . 193 16.6.4 interrupt enable clear register . . . . . . . . . . . 194 16.6.5 time-out value register . . . . . . . . . . . . . . . . . 195 16.6.6 i2c clock divider register . . . . . . . . . . . . . . . 196 16.6.7 i2c interrupt status register . . . . . . . . . . . . . 196 16.6.8 master control register . . . . . . . . . . . . . . . . . 197 16.6.9 master time . . . . . . . . . . . . . . . . . . . . . . . . . 198 16.6.10 master data register . . . . . . . . . . . . . . . . . . 199 16.6.11 slave control register . . . . . . . . . . . . . . . . . 199 16.6.12 slave data register . . . . . . . . . . . . . . . . . . . 200 16.6.13 slave address registers . . . . . . . . . . . . . . . . 201 16.6.14 slave address qualifier 0 register . . . . . . . . 201 16.6.15 monitor data register . . . . . . . . . . . . . . . . . . 202 16.7 functional description . . . . . . . . . . . . . . . . . 203 16.7.1 bus rates and timing co nsiderations . . . . . . 203 16.7.1.1 rate calculations . . . . . . . . . . . . . . . . . . . . . 203 16.7.2 time-out . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 16.7.3 ten-bit addressing . . . . . . . . . . . . . . . . . . . . 204 16.7.4 clocking and power considerations . . . . . . . 204 16.7.5 lnterrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 chapter 17: lpc800 spi0/1 17.1 how to read this chapter . . . . . . . . . . . . . . . . 206 17.2 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 17.3 basic configuration . . . . . . . . . . . . . . . . . . . . 206 17.3.1 configure the spis for wake-up . . . . . . . . . . 206 17.3.1.1 wake-up from sleep mode . . . . . . . . . . . . . . 207 17.3.1.2 wake-up from deep-sleep or power-down mode. 207 17.4 pin description . . . . . . . . . . . . . . . . . . . . . . . . 207 17.5 general description . . . . . . . . . . . . . . . . . . . . 209 17.6 register description . . . . . . . . . . . . . . . . . . . 209 17.6.1 spi configuration register . . . . . . . . . . . . . . 211 17.6.2 spi delay register. . . . . . . . . . . . . . . . . . . . . 212 17.6.3 spi status register . . . . . . . . . . . . . . . . . . . . 213 17.6.4 spi interrupt enable read and set register . 214 17.6.5 spi interrupt enable clear register. . . . . . . . 215 17.6.6 spi receiver data register . . . . . . . . . . . . . . 215 17.6.7 spi transmitter data and control register . . 216 17.6.8 spi transmitter data regi ster . . . . . . . . . . 217 17.6.9 spi transmitter control re gister. . . . . . . . . . 217 17.6.10 spi divider register . . . . . . . . . . . . . . . . . . . 218 17.6.11 spi interrupt status regist er. . . . . . . . . . . . . 218 17.7 functional description . . . . . . . . . . . . . . . . . 220 17.7.1 operating modes: clock and phase selection 220 17.7.2 frame delays . . . . . . . . . . . . . . . . . . . . . . . . 221 17.7.2.1 pre_delay and post_delay . . . . . . . . . . . . . . 221 17.7.2.2 frame_delay . . . . . . . . . . . . . . . . . . . . . . . . 222 17.7.2.3 transfer_delay . . . . . . . . . . . . . . . . . . . . . . . 223 17.7.3 clocking and data rates . . . . . . . . . . . . . . . . 224 17.7.3.1 data rate calc ulations . . . . . . . . . . . . . . . . . 224 17.7.4 slave select . . . . . . . . . . . . . . . . . . . . . . . . . 224 17.7.5 data lengths greater than 16 bits . . . . . . . . . 224 17.7.6 data stalls . . . . . . . . . . . . . . . . . . . . . . . . . . 225 chapter 18: lpc800 cyclic redundancy check (crc) engine 18.1 how to read this chapter . . . . . . . . . . . . . . . . 227 18.2 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 18.3 basic configuration . . . . . . . . . . . . . . . . . . . . 227 18.4 pin description . . . . . . . . . . . . . . . . . . . . . . . . 227 18.5 general description . . . . . . . . . . . . . . . . . . . . 227 18.6 description . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 18.7 register description . . . . . . . . . . . . . . . . . . . 228 18.7.1 crc mode register . . . . . . . . . . . . . . . . . . . 229 18.7.2 crc seed register . . . . . . . . . . . . . . . . . . . . 229 18.7.3 crc checksum register . . . . . . . . . . . . . . . . 229 18.7.4 crc data register . . . . . . . . . . . . . . . . . . . . 229 18.8 functional description . . . . . . . . . . . . . . . . . 231 18.8.1 crc-ccitt set-up . . . . . . . . . . . . . . . . . . . 231 18.8.2 crc-16 set-up . . . . . . . . . . . . . . . . . . . . . . . 231 18.8.3 crc-32 set-up . . . . . . . . . . . . . . . . . . . . . . . 231 chapter 19: lpc800 flash controller 19.1 how to read this chapter . . . . . . . . . . . . . . . . 232 19.2 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 19.3 general description . . . . . . . . . . . . . . . . . . . . 232 19.4 register description . . . . . . . . . . . . . . . . . . . 232 19.4.1 flash configuration register . . . . . . . . . . . . . 232 19.4.2 flash signature start address register . . . . . 233 19.4.3 flash signature stop address register. . . . . . 233 19.4.4 flash signature generatio n result register . . 233 19.5 functional description . . . . . . . . . . . . . . . . . 234 19.5.1 flash signature generation . . . . . . . . . . . . . 234 19.5.1.1 signature generat ion address and control registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 19.5.1.2 signature generation . . . . . . . . . . . . . . . . . . 234 19.5.1.3 content verification . . . . . . . . . . . . . . . . . . . 235 chapter 20: lpc800 boot rom 20.1 how to read this chapter . . . . . . . . . . . . . . . . 236 20.2 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 311 of 313 nxp semiconductors um10601 chapter 27: supplementary information 20.3 general description . . . . . . . . . . . . . . . . . . . . 236 20.3.1 boot loader . . . . . . . . . . . . . . . . . . . . . . . . . . 236 20.3.2 rom-based apis . . . . . . . . . . . . . . . . . . . . . 237 20.4 functional description . . . . . . . . . . . . . . . . . 238 20.4.1 boot pins . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 20.4.2 memory map after any rese t . . . . . . . . . . . . 238 20.4.3 boot process . . . . . . . . . . . . . . . . . . . . . . . . 238 20.4.4 boot process flowchart. . . . . . . . . . . . . . . . . 239 chapter 21: lpc800 flash isp and iap programming 21.1 how to read this chapter . . . . . . . . . . . . . . . . 240 21.2 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 21.3 general description . . . . . . . . . . . . . . . . . . . . 240 21.3.1 flash configuration . . . . . . . . . . . . . . . . . . . . 240 21.3.2 flash content protection mechanism . . . . . . 241 21.3.3 code read protection (crp) . . . . . . . . . . . . 241 21.3.3.1 isp entry protection . . . . . . . . . . . . . . . . . . . 243 21.4 api description . . . . . . . . . . . . . . . . . . . . . . . 243 21.4.1 uart isp commands. . . . . . . . . . . . . . . . . . 243 21.4.1.1 unlock . . . . . . . . . . . . . . . . . 244 21.4.1.2 set baud rate . . . 244 21.4.1.3 echo . . . . . . . . . . . . . . . . . . . . . . . 245 21.4.1.4 write to ram 245 21.4.1.5 read memory
. . . 245 21.4.1.6 prepare sector(s) for write operation . . . . . . . . . . 246 21.4.1.7 copy ram to flash . . . . . . . . . . . . . . . . 246 21.4.1.8 go
. . . . . . . . . . . . . . . . 247 21.4.1.9 erase sector(s) . . . . . . . . . . . . . . . . . . . . . . 248 21.4.1.10 blank check sector(s) . . . . . . . . . . . . . . . . . . . . . . 248 21.4.1.11 read part identification number . . . . . . . . . 248 21.4.1.12 read boot code version number . . . . . . . . . 249 21.4.1.13 compare 249 21.4.1.14 readuid . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 21.4.1.15 uart isp return codes . . . . . . . . . . . . . . . 250 21.4.2 iap commands. . . . . . . . . . . . . . . . . . . . . . . 250 21.4.2.1 prepare sector(s) for write operation (iap) . 252 21.4.2.2 copy ram to flash (iap) . . . . . . . . . . . . . . . 253 21.4.2.3 erase sector(s) (iap). . . . . . . . . . . . . . . . . . 254 21.4.2.4 blank check sector(s) (iap) . . . . . . . . . . . . . 254 21.4.2.5 read part identification number (iap) . . . . . 254 21.4.2.6 read boot code version number (iap) . . . . 255 21.4.2.7 compare (iap). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 21.4.2.8 reinvoke isp (iap) . . . . . . . . . . . . . . . . . . . 256 21.4.2.9 readuid (iap) . . . . . . . . . . . . . . . . . . . . . . . 256 21.4.2.10 erase page. . . . . . . . . . . . . . . . . . . . . . . . . . 256 21.4.2.11 iap status codes . . . . . . . . . . . . . . . . . . . . . 256 21.5 functional description . . . . . . . . . . . . . . . . . 257 21.5.1 uart communication prot ocol . . . . . . . . . . 257 21.5.1.1 uart isp command forma t. . . . . . . . . . . . . 257 21.5.1.2 uart isp resp onse format . . . . . . . . . . . . . 257 21.5.1.3 uart isp data format . . . . . . . . . . . . . . . . . 257 21.5.2 memory and interrupt use for isp and iap . 257 21.5.2.1 interrupts during uart is p . . . . . . . . . . . . . 257 21.5.2.2 interrupts during iap . . . . . . . . . . . . . . . . . . 258 21.5.2.3 ram used by isp command handler. . . . . . 258 21.5.2.4 ram used by iap command handler. . . . . . 258 21.5.3 debugging . . . . . . . . . . . . . . . . . . . . . . . . . . 258 21.5.3.1 comparing flash images . . . . . . . . . . . . . . . 258 21.5.3.2 serial wire debug (swd) flash programming interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 chapter 22: lpc800 power profile api rom driver 22.1 how to read this chapter . . . . . . . . . . . . . . . . 259 22.2 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 22.3 general description . . . . . . . . . . . . . . . . . . . . 259 22.4 api description . . . . . . . . . . . . . . . . . . . . . . . 260 22.4.1 set_pll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 22.4.1.1 param0: system pll input frequency and param1: expected syst em clock . . . . . . . . . . 262 22.4.1.2 param2: mode . . . . . . . . . . . . . . . . . . . . . . . 262 22.4.1.3 param3 : system pll lock time-out . . . . . . . . 263 22.4.2 set_power . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 22.4.2.1 param0: main clock . . . . . . . . . . . . . . . . . . . 265 22.4.2.2 param1: mode . . . . . . . . . . . . . . . . . . . . . . . 265 22.4.2.3 param2: system clock . . . . . . . . . . . . . . . . . 265 22.5 functional description . . . . . . . . . . . . . . . . . 265 22.5.1 clock control . . . . . . . . . . . . . . . . . . . . . . . . . 265 22.5.1.1 invalid frequency (device maximum clock rate exceeded) . . . . . . . . . . . . . . . . . . . . . . . . . . 265 22.5.1.2 invalid frequency se lection (system clock divider restrictions) . . . . . . . . . . . . . . . . . . . . . . . . . 266 22.5.1.3 exact solution cannot be found (pll) . . . . . 266 22.5.1.4 system clock less than or equal to the expected value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 22.5.1.5 system clock grea ter than or equal to the expected value. . . . . . . . . . . . . . . . . . . . . . . 266 22.5.1.6 system clock approxim ately equal to the expected value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 22.5.2 power control . . . . . . . . . . . . . . . . . . . . . . . . 267 22.5.2.1 invalid frequency (device maximum clock rate exceeded) . . . . . . . . . . . . . . . . . . . . . . . . . . 267 22.5.2.2 an applicable power setu p. . . . . . . . . . . . . . 267 chapter 23: lpc800 i2c-bus rom api 23.1 how to read this chapter . . . . . . . . . . . . . . . . 268 23.2 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra um10601 all information provided in this document is subject to legal disclaimers. ? nxp b.v. 2012. all rights reserved. preliminary user manual rev. 1.0 ? 7 november 2012 312 of 313 nxp semiconductors um10601 chapter 27: supplementary information 23.3 general description . . . . . . . . . . . . . . . . . . . . 268 23.4 api description . . . . . . . . . . . . . . . . . . . . . . . 269 23.4.1 isr handler. . . . . . . . . . . . . . . . . . . . . . . . . . 271 23.4.2 i2c master transmit polling . . . . . . . . . . . . . 271 23.4.3 i2c master receive polling . . . . . . . . . . . . . 271 23.4.4 i2c master transmit and receive polling . . 272 23.4.5 i2c master transmit interrupt. . . . . . . . . . . . 272 23.4.6 i2c master receive interrupt . . . . . . . . . . . . 272 23.4.7 i2c master transmit receive interrupt. . . . . 273 23.4.8 i2c slave receive polling . . . . . . . . . . . . . . 273 23.4.9 i2c slave transmit polling . . . . . . . . . . . . . . 273 23.4.10 i2c slave receive interrupt . . . . . . . . . . . . . 274 23.4.11 i2c slave transmit interrupt. . . . . . . . . . . . . 274 23.4.12 i2c set slave address . . . . . . . . . . . . . . . . . 274 23.4.13 i2c get memory size . . . . . . . . . . . . . . . . . . 274 23.4.14 i2c setup . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 23.4.15 i2c set bit rate . . . . . . . . . . . . . . . . . . . . . . 275 23.4.16 i2c get firmware version . . . . . . . . . . . . . . 275 23.4.17 i2c get status . . . . . . . . . . . . . . . . . . . . . . . 275 23.4.18 i2c time-out value . . . . . . . . . . . . . . . . . . . . 276 23.4.19 error codes . . . . . . . . . . . . . . . . . . . . . . . . . 276 23.4.20 i2c status code . . . . . . . . . . . . . . . . . . . . . . 276 23.4.21 i2c rom driver variables. . . . . . . . . . . . . . . 276 23.4.21.1 i2c handle . . . . . . . . . . . . . . . . . . . . . . . . . . 276 23.4.22 param and result structure . . . . . . . . . . 277 23.4.23 error structure . . . . . . . . . . . . . . . . . . . . . . . 277 23.4.24 i2c mode . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 23.4.25 i2c rom driver pointer . . . . . . . . . . . . . . . . 278 23.5 functional description . . . . . . . . . . . . . . . . . 278 23.5.1 i2c set-up . . . . . . . . . . . . . . . . . . . . . . . . . . 278 23.5.2 i2c master mode set-up . . . . . . . . . . . . . . . 278 23.5.3 i2c slave mode set-up . . . . . . . . . . . . . . . . 279 23.5.4 i2c master transmit/recei ve. . . . . . . . . . . . 280 23.5.5 i2c slave mode transmit /receive. . . . . . . . 281 23.5.6 i2c time-out feature . . . . . . . . . . . . . . . . . . . 282 chapter 24: lpc800 usart api rom driver routines 24.1 how to read this chapter . . . . . . . . . . . . . . . . 284 24.2 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 24.3 general description . . . . . . . . . . . . . . . . . . . . 284 24.4 api description . . . . . . . . . . . . . . . . . . . . . . . 285 24.4.1 uart get memory size. . . . . . . . . . . . . . . . . 285 24.4.2 uart setup . . . . . . . . . . . . . . . . . . . . . . . . . 286 24.4.3 uart init . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 24.4.4 uart get character . . . . . . . . . . . . . . . . . . . 286 24.4.5 uart put character . . . . . . . . . . . . . . . . . . . 286 24.4.6 uart get line. . . . . . . . . . . . . . . . . . . . . . . . 287 24.4.7 uart put line. . . . . . . . . . . . . . . . . . . . . . . . 287 24.4.8 uart interrupt service ro utine. . . . . . . . . . . 287 24.4.9 error codes . . . . . . . . . . . . . . . . . . . . . . . . . 287 24.4.10 uart rom driver variables . . . . . . . . . . . . . 288 24.4.10.1 uart_config structure . . . . . . . . . . . . . . 288 24.4.10.2 uart_handle_t. . . . . . . . . . . . . . . . . . . . 288 24.4.10.3 uart_param_t. . . . . . . . . . . . . . . . . . . . . 288 24.5 functional description . . . . . . . . . . . . . . . . . 289 chapter 25: lpc800 debugging 25.1 how to read this chapter . . . . . . . . . . . . . . . . 290 25.2 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 25.3 general description . . . . . . . . . . . . . . . . . . . . 290 25.4 pin description . . . . . . . . . . . . . . . . . . . . . . . . 290 25.5 functional description . . . . . . . . . . . . . . . . . 291 25.5.1 debug limitations . . . . . . . . . . . . . . . . . . . . . 291 25.5.2 debug connections for sw d . . . . . . . . . . . . 291 25.5.3 boundary scan . . . . . . . . . . . . . . . . . . . . . . . 292 chapter 26: lpc800 packages and pin description 26.1 packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 26.2 pin description . . . . . . . . . . . . . . . . . . . . . . . 294 chapter 27: supplementary information 27.1 abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . 298 27.2 references . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 27.3 legal information. . . . . . . . . . . . . . . . . . . . . . 299 27.3.1 definitions. . . . . . . . . . . . . . . . . . . . . . . . . . . 299 27.3.2 disclaimers . . . . . . . . . . . . . . . . . . . . . . . . . . 299 27.3.3 trademarks . . . . . . . . . . . . . . . . . . . . . . . . . 299 27.4 tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 27.5 figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 27.6 contents. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
draft draft draft dr draft draft draft d raf draft draft dra f t d raft dr aft d dra f t draft draft d raft draft d raft dra nxp semiconductors um10601 chapter 27: supplementary information ? nxp b.v. 2012. all rights reserved. for more information, please visit: http://www.nxp.com for sales office addresses, please se nd an email to: salesaddresses@nxp.com date of release: 7 november 2012 document identifier: um10601 please be aware that important notices concerning this document and the product(s) described herein, have been included in section ?legal information?. 313


▲Up To Search▲   

 
Price & Availability of LPC812M101FDH20

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X